Commit 2c77fc41 authored by Akikonata's avatar Akikonata

test

parent 8f997604
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
...@@ -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
...@@ -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
This diff is collapsed.
...@@ -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': 30, 'root-radius': 0,
'root-space': 10, 'root-space': 10,
'main-color': '#333', 'main-color': '#333',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment