Commit 2c77fc41 authored by Akikonata's avatar Akikonata

test

parent 8f997604
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
......@@ -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
......@@ -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
This diff is collapsed.
......@@ -5,7 +5,7 @@ KityMinder.registerTheme('bottom', {
'root-font-size': 24,
'root-padding': [15, 25],
'root-margin': 0,
'root-radius': 30,
'root-radius': 0,
'root-space': 10,
'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