Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kityminder-core
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
吴志俊
kityminder-core
Commits
d471a6a8
Commit
d471a6a8
authored
Jun 16, 2014
by
techird
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码整理
parent
9b449152
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
81 additions
and
74 deletions
+81
-74
connect.js
src/core/connect.js
+7
-2
outline.js
src/module/outline.js
+74
-72
No files found.
src/core/connect.js
View file @
d471a6a8
...
@@ -32,13 +32,18 @@ kity.extendClass(Minder, {
...
@@ -32,13 +32,18 @@ kity.extendClass(Minder, {
node
.
_connection
=
connection
;
node
.
_connection
=
connection
;
this
.
getRenderContainer
().
prependShape
(
connection
);
if
(
!
this
.
_connectContainer
)
{
this
.
_connectContainer
=
new
kity
.
Group
().
setId
(
KityMinder
.
uuid
(
'minder_connect_group'
));
this
.
getRenderContainer
().
prependShape
(
this
.
_connectContainer
);
}
this
.
_connectContainer
.
addShape
(
connection
);
},
},
removeConnect
:
function
(
node
)
{
removeConnect
:
function
(
node
)
{
var
me
=
this
;
var
me
=
this
;
node
.
traverse
(
function
(
node
)
{
node
.
traverse
(
function
(
node
)
{
me
.
getRenderContainer
()
.
removeShape
(
node
.
_connection
);
me
.
_connectContainer
.
removeShape
(
node
.
_connection
);
});
});
},
},
...
...
src/module/outline.js
View file @
d471a6a8
...
@@ -2,81 +2,83 @@
...
@@ -2,81 +2,83 @@
var
wireframe
=
/wire/
.
test
(
window
.
location
.
href
);
var
wireframe
=
/wire/
.
test
(
window
.
location
.
href
);
var
OutlineRenderer
=
kity
.
createClass
(
'OutlineRenderer'
,
{
base
:
Renderer
,
create
:
function
(
node
)
{
var
group
=
new
kity
.
Group
();
var
outline
=
this
.
outline
=
new
kity
.
Rect
()
.
setId
(
KityMinder
.
uuid
(
'node_outline'
));
var
shadow
=
this
.
shadow
=
new
kity
.
Rect
()
.
setId
(
KityMinder
.
uuid
(
'node_shadow'
))
.
fill
(
'black'
)
.
setOpacity
(
0.25
);
group
.
addShapes
([
shadow
,
outline
]);
if
(
wireframe
)
{
var
oxy
=
this
.
oxy
=
new
kity
.
Path
()
.
stroke
(
'#f6f'
)
.
setPathData
(
'M0,-50L0,50M-50,0L50,0'
);
var
box
=
this
.
wireframe
=
new
kity
.
Rect
()
.
stroke
(
'lightgreen'
);
group
.
addShapes
([
oxy
,
box
]);
}
this
.
bringToBack
=
true
;
return
group
;
},
update
:
function
(
created
,
node
)
{
var
contentBox
=
node
.
getContentBox
();
var
paddingLeft
=
node
.
getStyle
(
'padding-left'
),
paddingRight
=
node
.
getStyle
(
'padding-right'
),
paddingTop
=
node
.
getStyle
(
'padding-top'
),
paddingBottom
=
node
.
getStyle
(
'padding-bottom'
);
var
outlineBox
=
{
x
:
contentBox
.
x
-
paddingLeft
,
y
:
contentBox
.
y
-
paddingTop
,
width
:
contentBox
.
width
+
paddingLeft
+
paddingRight
,
height
:
contentBox
.
height
+
paddingTop
+
paddingBottom
};
this
.
outline
.
setPosition
(
outlineBox
.
x
,
outlineBox
.
y
)
.
setSize
(
outlineBox
.
width
,
outlineBox
.
height
)
.
setRadius
(
node
.
getStyle
(
'radius'
))
.
fill
(
node
.
isSelected
()
?
node
.
getStyle
(
'selected-background'
)
:
node
.
getStyle
(
'background'
));
if
(
node
.
getLevel
()
<
2
)
{
this
.
shadow
.
setVisible
(
true
)
.
setPosition
(
outlineBox
.
x
+
4
,
outlineBox
.
y
+
5
)
.
setSize
(
outlineBox
.
width
,
outlineBox
.
height
)
.
setRadius
(
node
.
getStyle
(
'radius'
));
}
else
{
this
.
shadow
.
setVisible
(
false
);
}
if
(
wireframe
)
{
this
.
wireframe
.
setPosition
(
outlineBox
.
x
,
outlineBox
.
y
)
.
setSize
(
outlineBox
.
width
,
outlineBox
.
height
);
}
return
outlineBox
;
}
});
KityMinder
.
registerModule
(
'OutlineModule'
,
function
()
{
KityMinder
.
registerModule
(
'OutlineModule'
,
function
()
{
return
{
return
{
renderers
:
{
renderers
:
{
outline
:
kity
.
createClass
(
'OutlineRenderer'
,
{
outline
:
OutlineRenderer
base
:
Renderer
,
create
:
function
(
node
)
{
var
group
=
new
kity
.
Group
();
var
outline
=
this
.
outline
=
new
kity
.
Rect
()
.
setId
(
KityMinder
.
uuid
(
'node_outline'
));
var
shadow
=
this
.
shadow
=
new
kity
.
Rect
()
.
setId
(
KityMinder
.
uuid
(
'node_shadow'
))
.
fill
(
'black'
)
.
setOpacity
(
0.25
);
group
.
addShapes
([
shadow
,
outline
]);
if
(
wireframe
)
{
var
oxy
=
this
.
oxy
=
new
kity
.
Path
()
.
stroke
(
'#f6f'
)
.
setPathData
(
'M0,-50L0,50M-50,0L50,0'
);
var
box
=
this
.
wireframe
=
new
kity
.
Rect
()
.
stroke
(
'lightgreen'
);
group
.
addShapes
([
oxy
,
box
]);
}
this
.
bringToBack
=
true
;
return
group
;
},
update
:
function
(
created
,
node
)
{
var
contentBox
=
node
.
getContentBox
();
var
paddingLeft
=
node
.
getStyle
(
'padding-left'
),
paddingRight
=
node
.
getStyle
(
'padding-right'
),
paddingTop
=
node
.
getStyle
(
'padding-top'
),
paddingBottom
=
node
.
getStyle
(
'padding-bottom'
);
var
outlineBox
=
{
x
:
contentBox
.
x
-
paddingLeft
,
y
:
contentBox
.
y
-
paddingTop
,
width
:
contentBox
.
width
+
paddingLeft
+
paddingRight
,
height
:
contentBox
.
height
+
paddingTop
+
paddingBottom
};
this
.
outline
.
setPosition
(
outlineBox
.
x
,
outlineBox
.
y
)
.
setSize
(
outlineBox
.
width
,
outlineBox
.
height
)
.
setRadius
(
node
.
getStyle
(
'radius'
))
.
fill
(
node
.
isSelected
()
?
node
.
getStyle
(
'selected-background'
)
:
node
.
getStyle
(
'background'
));
if
(
node
.
getLevel
()
<
2
)
{
this
.
shadow
.
setVisible
(
true
)
.
setPosition
(
outlineBox
.
x
+
4
,
outlineBox
.
y
+
5
)
.
setSize
(
outlineBox
.
width
,
outlineBox
.
height
)
.
setRadius
(
node
.
getStyle
(
'radius'
));
}
else
{
this
.
shadow
.
setVisible
(
false
);
}
if
(
wireframe
)
{
this
.
wireframe
.
setPosition
(
outlineBox
.
x
,
outlineBox
.
y
)
.
setSize
(
outlineBox
.
width
,
outlineBox
.
height
);
}
return
outlineBox
;
}
})
}
}
};
};
});
});
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment