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
)
{
var
me
=
this
,
label
=
me
.
getLang
(
'tooltips.'
+
name
),
options
=
{
label
:
label
,
title
:
label
,
comboboxName
:
name
,
items
:
me
.
getLayoutStyleItems
()
||
[],
itemStyles
:
[],
value
:
me
.
getLayoutStyleItems
(),
autowidthitem
:
[],
enabledRecord
:
false
},
$combox
=
null
;
if
(
options
.
items
.
length
==
0
)
{
return
null
;
}
//
var me = this,
//
label = me.getLang('tooltips.' + name),
//
options = {
//
label: label,
//
title: label,
//
comboboxName: name,
//
items: me.getLayoutStyleItems() || [],
//
itemStyles: [],
//
value: me.getLayoutStyleItems(),
//
autowidthitem: [],
//
enabledRecord: false
//
},
//
$combox = null;
//
if (options.items.length == 0) {
//
return null;
//
}
utils
.
each
(
options
.
items
,
function
(
i
,
item
)
{
options
.
items
[
i
]
=
me
.
getLang
(
'layout'
)[
item
];
});
//实例化
$combox
=
$
.
kmuibuttoncombobox
(
options
).
css
(
'zIndex'
,
me
.
getOptions
(
'zIndex'
)
+
1
);
var
comboboxWidget
=
$combox
.
kmui
();
//
utils.each(options.items, function(i, item) {
//
options.items[i] = me.getLang('layout')[item];
//
});
//
//
实例化
//
$combox = $.kmuibuttoncombobox(options).css('zIndex', me.getOptions('zIndex') + 1);
//
var comboboxWidget = $combox.kmui();
comboboxWidget
.
on
(
'comboboxselect'
,
function
(
evt
,
res
)
{
me
.
execCommand
(
name
,
res
.
value
);
me
.
initStyle
();
}).
on
(
"beforeshow"
,
function
()
{
if
(
$combox
.
parent
().
length
===
0
)
{
$combox
.
appendTo
(
me
.
$container
.
find
(
'.kmui-dialog-container'
));
}
//
comboboxWidget.on('comboboxselect', function(evt, res) {
//
me.execCommand(name, res.value);
//
me.initStyle();
//
}).on("beforeshow", function() {
//
if ($combox.parent().length === 0) {
//
$combox.appendTo(me.$container.find('.kmui-dialog-container'));
//
}
});
//状态反射
me
.
on
(
'interactchange'
,
function
()
{
var
state
=
this
.
queryCommandState
(
name
),
value
=
this
.
queryCommandValue
(
name
);
//设置按钮状态
//
});
//
//
状态反射
//
me.on('interactchange', function() {
//
var state = this.queryCommandState(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
)
{
//设置label
value
=
value
.
replace
(
/
[
'"
]
/g
,
''
).
toLowerCase
().
split
(
/
[
'|"
]?\s
*,
\s
*
[\1]?
/
);
comboboxWidget
.
selectItemByLabel
(
value
);
}
//
if (value) {
//
//设置label
//
value = value.replace(/['"]/g, '').toLowerCase().split(/['|"]?\s*,\s*[\1]?/);
//
comboboxWidget.selectItemByLabel(value);
//
}
});
//
});
// var data = [];
// utils.each(me.getLayoutStyleItems(), function (i, v) {
// data.push({
// label: me.getLang('tooltips.' + name) + ' ' + v,
// cmdName: 'switchlayout',
// exec: function () {
// me.execCommand('switchlayout', v);
// }
// });
// });
// data.push({
// divider: 1
// });
// me.addContextmenu(data);
return
comboboxWidget
.
button
().
addClass
(
'kmui-combobox'
);
//
//
var data = [];
//
//
utils.each(me.getLayoutStyleItems(), function (i, v) {
//
//
data.push({
//
//
label: me.getLang('tooltips.' + name) + ' ' + v,
//
//
cmdName: 'switchlayout',
//
//
exec: function () {
//
//
me.execCommand('switchlayout', v);
//
//
}
//
//
});
//
//
});
//
//
data.push({
//
//
divider: 1
//
//
});
//
//
me.addContextmenu(data);
//
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({
y
=
nodeContentBox
.
height
+
node
.
getStyle
(
'margin-bottom'
)
+
children
[
i
].
getStyle
(
'margin-top'
);
children
[
i
].
setLayoutTransform
(
new
kity
.
Matrix
().
translate
(
x
,
y
));
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
(),
pBox
=
parent
.
getLayoutBox
();
var
abs
=
Math
.
abs
;
var
pathData
=
[];
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
(
box
.
cx
,
pBox
.
bottom
+
parent
.
getStyle
(
'margin-bottom'
)));
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({
y
+=
child
.
getStyle
(
'margin-top'
);
child
.
setLayoutTransform
(
new
kity
.
Matrix
().
translate
(
x
,
y
));
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
(),
pBox
=
parent
.
getLayoutBox
();
var
abs
=
Math
.
abs
;
var
pathData
=
[];
var
side
=
box
.
cx
>
pBox
.
cx
?
'right'
:
'left'
;
var
left
=
pBox
.
left
+
5
;
pathData
.
push
(
'M'
,
new
kity
.
Point
(
left
,
pBox
.
bottom
));
pathData
.
push
(
'L'
,
new
kity
.
Point
(
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', {
'root-font-size'
:
24
,
'root-padding'
:
[
15
,
25
],
'root-margin'
:
0
,
'root-radius'
:
3
0
,
'root-radius'
:
0
,
'root-space'
:
10
,
'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