Commit 6e17b170 authored by techird's avatar techird

merge

parents ddafa735 1fbea29d
......@@ -176,6 +176,10 @@ var Minder = KityMinder.Minder = kity.createClass('KityMinder', {
},
setStatus: function(status) {
if (status) {
this.fire('statuschange',{
lastStatus:this._status,
currentStatus:status
});
this._rollbackStatus = this._status;
this._status = status;
} else {
......
......@@ -33,6 +33,7 @@ KityMinder.registerLayout('bottom', kity.createClass({
return box;
});
var nodeContentBox = node.getContentBox();
node.setLayoutVector(new kity.Vector(nodeContentBox.cx - 5, nodeContentBox.bottom));
var i, x, y, child, childTreeBox, childContentBox;
var transform = new kity.Matrix();
x = -totalTreeWidth / 2;
......@@ -50,7 +51,6 @@ 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 - 5, childContentBox.bottom));
}
}
}
......@@ -64,6 +64,5 @@ KityMinder.registerConnectProvider('bottom', function(node, parent, connection)
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));
console.log(pathData);
connection.setPathData(pathData);
});
\ No newline at end of file
......@@ -28,6 +28,7 @@ KityMinder.registerLayout('filetree', kity.createClass({
return box;
});
var nodeContentBox = node.getContentBox();
node.setLayoutVector(new kity.Vector(nodeContentBox.left + 6, nodeContentBox.bottom));
var i, x, y, child, childTreeBox, childContentBox;
var transform = new kity.Matrix();
y = nodeContentBox.bottom + node.getStyle('margin-bottom');
......@@ -41,7 +42,6 @@ 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 + 6, childContentBox.bottom));
}
}
},
......
......@@ -316,6 +316,9 @@ var TreeDragger = kity.createClass('TreeDragger', {
_renderOrderHint: function(hint) {
this._orderHinter.render(hint);
},
preventDragMove:function(){
this._startPosition = null;
}
});
......@@ -340,6 +343,11 @@ KityMinder.registerModule('DragTree', function() {
dragger.dragEnd(e.getPosition(this.getRenderContainer()));
e.stopPropagation();
this.fire('contentchange');
},
'statuschange':function(e){
if(e.lastStatus == 'textedit' && e.currentStatus == 'normal'){
dragger.preventDragMove();
}
}
},
commands: {
......
......@@ -40,7 +40,6 @@ KityMinder.registerModule('TextEditModule', function() {
'events': {
'ready': function() {
this._renderTarget.appendChild(receiver.container);
this.getRenderContainer().addShape(sel);
},
'normal.beforemousedown textedit.beforemousedown inputready.beforemousedown': function(e) {
......@@ -73,7 +72,6 @@ KityMinder.registerModule('TextEditModule', function() {
var textShape = node.getTextShape();
textShape.setStyle('cursor', 'default');
if (this.isSingleSelect() && node.isSelected()) {
sel.collapse();
......@@ -182,6 +180,8 @@ KityMinder.registerModule('TextEditModule', function() {
inputStatusReady(e.getTargetNode());
km.setStatus('textedit');
receiver.updateSelectionShow();
},
// 'restoreScene': function() {
......@@ -226,7 +226,7 @@ KityMinder.registerModule('TextEditModule', function() {
};
if (cmds[e.commandName]) {
inputStatusReady(km.getSelectedNode());
selectionReadyShow = true;
receiver.updateSelectionShow();
return;
}
......@@ -236,18 +236,11 @@ KityMinder.registerModule('TextEditModule', function() {
this.setStatus('normal');
}
},
'layoutapply':function(e){
'layoutfinish':function(e){
if (e.node === receiver.minderNode && (this.getStatus() == 'textedit' || this.getStatus() == 'inputready') ) {//&& selectionReadyShow
receiver
.setBaseOffset()
.setContainerStyle()
.updateTextOffsetData();
if (sel.collapsed) {
receiver.updateSelection();
} else {
receiver.updateSelectionShow();
}
.setContainerStyle();
}
},
......
......@@ -61,16 +61,14 @@ Minder.Receiver = kity.createClass('Receiver', {
getTextShapeHeight: function() {
return this.textShape.getRenderBox().height;
},
appendTextShapeToPaper: function(paper) {
paper.addShape(this.textShape);
return this;
},
setKityMinder: function(km) {
this.km = km;
return this;
},
setMinderNode: function(node) {
this.minderNode = node;
//追加selection到节点
this._addSelection();
//更新minderNode下的textshape
this.setTextShape(node.getTextShape());
//更新textshape的baseOffset
......@@ -86,6 +84,10 @@ Minder.Receiver = kity.createClass('Receiver', {
return this;
},
_addSelection:function(){
if (this.selection.container) this.selection.remove();
this.minderNode.getRenderContainer().addShape(this.selection);
},
getMinderNode:function(){
return this.minderNode;
},
......@@ -119,7 +121,7 @@ Minder.Receiver = kity.createClass('Receiver', {
me.minderNode.render();
clearTimeout(me.inputTextTimer);
me.inputTextTimer = setTimeout(function(){
me.km.layout();
me.km.layout(300);
},250);
me.textShape = me.minderNode.getRenderer('TextRenderer').getRenderShape();
......@@ -314,8 +316,8 @@ Minder.Receiver = kity.createClass('Receiver', {
}
this.textData.push({
x: box.x + this.offset.x,
y: this.offset.y,
x: box.x ,
y: box.y,
width: box.width,
height: box.height
});
......@@ -326,6 +328,8 @@ Minder.Receiver = kity.createClass('Receiver', {
var me = this;
this.getTextOffsetData();
var hadChanged = false;
//要剪掉基数
this._getRelativeValue(offset);
utils.each(this.textData, function(i, v) {
//点击开始之前
if (i === 0 && offset.x <= v.x) {
......@@ -356,9 +360,13 @@ Minder.Receiver = kity.createClass('Receiver', {
this.selection.setHeight(this.getTextShapeHeight());
return this;
},
_getRelativeValue:function(offset){
offset.x = offset.x - this.offset.x;
offset.y = offset.y - this.offset.y;
},
updateSelectionByMousePosition: function(offset, dir) {
//要剪掉基数
this._getRelativeValue(offset);
var me = this;
utils.each(this.textData, function(i, v) {
//点击开始之前
......@@ -435,7 +443,7 @@ Minder.Receiver = kity.createClass('Receiver', {
return this;
},
updateContainerRangeBySel:function(){
this.updateRange(this.range)
this.updateRange(this.range);
},
setIndex: function(index) {
this.index = index;
......
......@@ -15,7 +15,7 @@ Minder.Selection = kity.createClass( 'Selection', {
this.setOpacity(0.5);
this.setStyle('cursor','text');
this._show = false;
this.selectionShowStatus = true;
},
collapse : function(toEnd){
......@@ -121,19 +121,5 @@ Minder.Selection = kity.createClass( 'Selection', {
},
isHide:function(){
return !this._show;
},
setTextShape: function ( text ) {
if ( !text ) {
this.text = new kity.Text();
} else {
this.text = text;
}
return this;
},
getTextShape: function () {
return this.text;
},
setTxtContent: function ( text ) {
this.text.setContent( text );
}
} );
\ No newline at end of file
......@@ -14,7 +14,7 @@ KityMinder.registerTheme('bottom', {
'main-font-size': 16,
'main-padding': [6, 20],
'main-margin': [30, 0, 10, 0],
'main-radius': 10,
'main-radius': 5,
'main-space': 5,
'sub-color': 'white',
......
......@@ -14,7 +14,7 @@ KityMinder.registerTheme('filetree', {
'main-font-size': 16,
'main-padding': [6, 20],
'main-margin': [15, 15, 15, 10],
'main-radius': 10,
'main-radius': 0,
'main-space': 5,
'sub-color': 'black',
......@@ -23,7 +23,7 @@ KityMinder.registerTheme('filetree', {
'sub-font-size': 12,
'sub-padding': [5, 10],
'sub-margin': [15, 15, 15, 10],
'sub-radius': 5,
'sub-radius': 0,
'sub-space': 5,
'connect-color': 'white',
......
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