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
2c77fc41
Commit
2c77fc41
authored
Jun 18, 2014
by
Akikonata
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test
parent
8f997604
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
372 additions
and
375 deletions
+372
-375
layout.js
src/adapter/layout.js
+57
-57
bottom.js
src/layout/bottom.js
+4
-4
filetree.js
src/layout/filetree.js
+3
-6
layout.js
src/module/layout.js
+307
-307
bottom.js
src/theme/bottom.js
+1
-1
No files found.
src/adapter/layout.js
View file @
2c77fc41
KM
.
registerToolbarUI
(
'switchlayout'
,
function
(
name
)
{
KM
.
registerToolbarUI
(
'switchlayout'
,
function
(
name
)
{
var
me
=
this
,
//
var me = this,
label
=
me
.
getLang
(
'tooltips.'
+
name
),
//
label = me.getLang('tooltips.' + name),
options
=
{
//
options = {
label
:
label
,
//
label: label,
title
:
label
,
//
title: label,
comboboxName
:
name
,
//
comboboxName: name,
items
:
me
.
getLayoutStyleItems
()
||
[],
//
items: me.getLayoutStyleItems() || [],
itemStyles
:
[],
//
itemStyles: [],
value
:
me
.
getLayoutStyleItems
(),
//
value: me.getLayoutStyleItems(),
autowidthitem
:
[],
//
autowidthitem: [],
enabledRecord
:
false
//
enabledRecord: false
},
//
},
$combox
=
null
;
//
$combox = null;
if
(
options
.
items
.
length
==
0
)
{
//
if (options.items.length == 0) {
return
null
;
//
return null;
}
//
}
utils
.
each
(
options
.
items
,
function
(
i
,
item
)
{
//
utils.each(options.items, function(i, item) {
options
.
items
[
i
]
=
me
.
getLang
(
'layout'
)[
item
];
//
options.items[i] = me.getLang('layout')[item];
});
//
});
//实例化
//
//
实例化
$combox
=
$
.
kmuibuttoncombobox
(
options
).
css
(
'zIndex'
,
me
.
getOptions
(
'zIndex'
)
+
1
);
//
$combox = $.kmuibuttoncombobox(options).css('zIndex', me.getOptions('zIndex') + 1);
var
comboboxWidget
=
$combox
.
kmui
();
//
var comboboxWidget = $combox.kmui();
comboboxWidget
.
on
(
'comboboxselect'
,
function
(
evt
,
res
)
{
//
comboboxWidget.on('comboboxselect', function(evt, res) {
me
.
execCommand
(
name
,
res
.
value
);
//
me.execCommand(name, res.value);
me
.
initStyle
();
//
me.initStyle();
}).
on
(
"beforeshow"
,
function
()
{
//
}).on("beforeshow", function() {
if
(
$combox
.
parent
().
length
===
0
)
{
//
if ($combox.parent().length === 0) {
$combox
.
appendTo
(
me
.
$container
.
find
(
'.kmui-dialog-container'
));
//
$combox.appendTo(me.$container.find('.kmui-dialog-container'));
}
//
}
});
//
});
//状态反射
//
//
状态反射
me
.
on
(
'interactchange'
,
function
()
{
//
me.on('interactchange', function() {
var
state
=
this
.
queryCommandState
(
name
),
//
var state = this.queryCommandState(name),
value
=
this
.
queryCommandValue
(
name
);
//
value = this.queryCommandValue(name);
//设置按钮状态
//
//设置按钮状态
comboboxWidget
.
button
().
kmui
().
disabled
(
state
==
-
1
).
active
(
state
==
1
);
//
comboboxWidget.button().kmui().disabled(state == -1).active(state == 1);
if
(
value
)
{
//
if (value) {
//设置label
//
//设置label
value
=
value
.
replace
(
/
[
'"
]
/g
,
''
).
toLowerCase
().
split
(
/
[
'|"
]?\s
*,
\s
*
[\1]?
/
);
//
value = value.replace(/['"]/g, '').toLowerCase().split(/['|"]?\s*,\s*[\1]?/);
comboboxWidget
.
selectItemByLabel
(
value
);
//
comboboxWidget.selectItemByLabel(value);
}
//
}
});
//
});
// var data = [];
//
//
var data = [];
// utils.each(me.getLayoutStyleItems(), function (i, v) {
//
//
utils.each(me.getLayoutStyleItems(), function (i, v) {
// data.push({
//
//
data.push({
// label: me.getLang('tooltips.' + name) + ' ' + v,
//
//
label: me.getLang('tooltips.' + name) + ' ' + v,
// cmdName: 'switchlayout',
//
//
cmdName: 'switchlayout',
// exec: function () {
//
//
exec: function () {
// me.execCommand('switchlayout', v);
//
//
me.execCommand('switchlayout', v);
// }
//
//
}
// });
//
//
});
// });
//
//
});
// data.push({
//
//
data.push({
// divider: 1
//
//
divider: 1
// });
//
//
});
// me.addContextmenu(data);
//
//
me.addContextmenu(data);
return
comboboxWidget
.
button
().
addClass
(
'kmui-combobox'
);
//
return comboboxWidget.button().addClass('kmui-combobox');
});
});
\ No newline at end of file
src/layout/bottom.js
View file @
2c77fc41
...
@@ -50,20 +50,20 @@ KityMinder.registerLayout('bottom', kity.createClass({
...
@@ -50,20 +50,20 @@ KityMinder.registerLayout('bottom', kity.createClass({
y
=
nodeContentBox
.
height
+
node
.
getStyle
(
'margin-bottom'
)
+
children
[
i
].
getStyle
(
'margin-top'
);
y
=
nodeContentBox
.
height
+
node
.
getStyle
(
'margin-bottom'
)
+
children
[
i
].
getStyle
(
'margin-top'
);
children
[
i
].
setLayoutTransform
(
new
kity
.
Matrix
().
translate
(
x
,
y
));
children
[
i
].
setLayoutTransform
(
new
kity
.
Matrix
().
translate
(
x
,
y
));
x
+=
childTreeBox
.
width
/
2
+
children
[
i
].
getStyle
(
'margin-right'
);
x
+=
childTreeBox
.
width
/
2
+
children
[
i
].
getStyle
(
'margin-right'
);
child
.
setLayoutVector
(
new
kity
.
Vector
(
childContentBox
.
cx
,
childContentBox
.
bottom
));
child
.
setLayoutVector
(
new
kity
.
Vector
(
childContentBox
.
cx
-
5
,
childContentBox
.
bottom
));
}
}
}
}
}
}
}));
}));
KityMinder
.
registerConnectProvider
(
'bottom'
,
function
(
node
,
parent
)
{
KityMinder
.
registerConnectProvider
(
'bottom'
,
function
(
node
,
parent
,
connection
)
{
var
box
=
node
.
getLayoutBox
(),
var
box
=
node
.
getLayoutBox
(),
pBox
=
parent
.
getLayoutBox
();
pBox
=
parent
.
getLayoutBox
();
var
abs
=
Math
.
abs
;
var
pathData
=
[];
var
pathData
=
[];
pathData
.
push
(
'M'
,
new
kity
.
Point
(
pBox
.
cx
,
pBox
.
bottom
));
pathData
.
push
(
'M'
,
new
kity
.
Point
(
pBox
.
cx
,
pBox
.
bottom
));
pathData
.
push
(
'L'
,
new
kity
.
Point
(
pBox
.
cx
,
pBox
.
bottom
+
parent
.
getStyle
(
'margin-bottom'
)));
pathData
.
push
(
'L'
,
new
kity
.
Point
(
pBox
.
cx
,
pBox
.
bottom
+
parent
.
getStyle
(
'margin-bottom'
)));
pathData
.
push
(
'L'
,
new
kity
.
Point
(
box
.
cx
,
pBox
.
bottom
+
parent
.
getStyle
(
'margin-bottom'
)));
pathData
.
push
(
'L'
,
new
kity
.
Point
(
box
.
cx
,
pBox
.
bottom
+
parent
.
getStyle
(
'margin-bottom'
)));
pathData
.
push
(
'L'
,
new
kity
.
Point
(
box
.
cx
,
box
.
top
));
pathData
.
push
(
'L'
,
new
kity
.
Point
(
box
.
cx
,
box
.
top
));
return
pathData
;
console
.
log
(
pathData
);
connection
.
setPathData
(
pathData
);
});
});
\ No newline at end of file
src/layout/filetree.js
View file @
2c77fc41
...
@@ -41,22 +41,19 @@ KityMinder.registerLayout('filetree', kity.createClass({
...
@@ -41,22 +41,19 @@ KityMinder.registerLayout('filetree', kity.createClass({
y
+=
child
.
getStyle
(
'margin-top'
);
y
+=
child
.
getStyle
(
'margin-top'
);
child
.
setLayoutTransform
(
new
kity
.
Matrix
().
translate
(
x
,
y
));
child
.
setLayoutTransform
(
new
kity
.
Matrix
().
translate
(
x
,
y
));
y
+=
childTreeBox
.
height
+
children
[
i
].
getStyle
(
'margin-bottom'
);
y
+=
childTreeBox
.
height
+
children
[
i
].
getStyle
(
'margin-bottom'
);
child
.
setLayoutVector
(
new
kity
.
Vector
(
childContentBox
.
left
+
5
,
childContentBox
.
cy
));
child
.
setLayoutVector
(
new
kity
.
Vector
(
childContentBox
.
left
+
10
,
childContentBox
.
bottom
));
}
}
}
}
}
}
}));
}));
KityMinder
.
registerConnectProvider
(
'filetree'
,
function
(
node
,
parent
)
{
KityMinder
.
registerConnectProvider
(
'filetree'
,
function
(
node
,
parent
,
connection
)
{
var
box
=
node
.
getLayoutBox
(),
var
box
=
node
.
getLayoutBox
(),
pBox
=
parent
.
getLayoutBox
();
pBox
=
parent
.
getLayoutBox
();
var
abs
=
Math
.
abs
;
var
pathData
=
[];
var
pathData
=
[];
var
side
=
box
.
cx
>
pBox
.
cx
?
'right'
:
'left'
;
var
left
=
pBox
.
left
+
5
;
var
left
=
pBox
.
left
+
5
;
pathData
.
push
(
'M'
,
new
kity
.
Point
(
left
,
pBox
.
bottom
));
pathData
.
push
(
'M'
,
new
kity
.
Point
(
left
,
pBox
.
bottom
));
pathData
.
push
(
'L'
,
new
kity
.
Point
(
left
,
box
.
cy
));
pathData
.
push
(
'L'
,
new
kity
.
Point
(
left
,
box
.
cy
));
pathData
.
push
(
'L'
,
new
kity
.
Point
(
box
.
left
,
box
.
cy
));
pathData
.
push
(
'L'
,
new
kity
.
Point
(
box
.
left
,
box
.
cy
));
return
pathData
;
connection
.
setPathData
(
pathData
)
;
});
});
\ No newline at end of file
src/module/layout.js
View file @
2c77fc41
This diff is collapsed.
Click to expand it.
src/theme/bottom.js
View file @
2c77fc41
...
@@ -5,7 +5,7 @@ KityMinder.registerTheme('bottom', {
...
@@ -5,7 +5,7 @@ KityMinder.registerTheme('bottom', {
'root-font-size'
:
24
,
'root-font-size'
:
24
,
'root-padding'
:
[
15
,
25
],
'root-padding'
:
[
15
,
25
],
'root-margin'
:
0
,
'root-margin'
:
0
,
'root-radius'
:
3
0
,
'root-radius'
:
0
,
'root-space'
:
10
,
'root-space'
:
10
,
'main-color'
:
'#333'
,
'main-color'
:
'#333'
,
...
...
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