Commit f5d4355f authored by Akikonata's avatar Akikonata

Merge branch 'dev' of https://github.com/kitygraph/kityminder into dev

parents d2e7e66f 99014b48
......@@ -59,12 +59,20 @@ KityMinder.registerModule( "TextEditModule", function () {
'beforemousemove':function(e){
if(mouseDownStatus){
e.stopPropagationImmediately();
var offset = e.getPosition();
if(Math.abs(offset.y - lastEvtPosition.y) > 2){
sel.setHide();
mouseDownStatus = false;
return;
}
dir = offset.x > lastEvtPosition.x ? 1 : (offset.x < lastEvtPosition.x ? -1 : dir);
receiver.updateSelectionByMousePosition(offset,dir)
.updateSelectionShow(dir);
sel.stroke('none',0);
lastEvtPosition = e.getPosition();
}
},
'dblclick':function(e){
......@@ -75,8 +83,8 @@ KityMinder.registerModule( "TextEditModule", function () {
sel.setStartOffset(0);
sel.setEndOffset(text.getContent().length);
sel.setShow();
receiver.updateSelectionShow(1)
.updateRange(range);
receiver.setContainerTxt(text.getContent()).updateSelectionShow(1)
.updateRange(range).setTextEditStatus(true)
}
},
......
......@@ -16,7 +16,12 @@ Minder.Range = kity.createClass('Range',{
return this;
},
setStart:function(node,index){
this.nativeRange.setStart(node,index);
try{
this.nativeRange.setStart(node,index);
}catch(e){
console.log(e)
}
return this;
},
setEnd:function(node,index){
......
......@@ -223,16 +223,17 @@ Minder.Receiver = kity.createClass('Receiver',{
return false;
}
if(offset.x >= v.x && offset.x <= v.x + v.width){
if(me.index == i){
if(i == 0){
me.selection.setStartOffset(i)
}
me.selection.setEndOffset(i + (dir == 1 ? 1 : 0))
}else if(i > me.index){
me.selection.setStartOffset(me.index);
me.selection.setEndOffset(i + (dir == 1 ? 1 : 0))
}else{
me.selection.setStartOffset(i + (dir == 1 ? 1 : 0))
me.selection.setStartOffset(i + (dir == 1 ? 1 : 0));
me.selection.setEndOffset(me.index)
}
return false;
......@@ -246,7 +247,7 @@ Minder.Receiver = kity.createClass('Receiver',{
width = 0 ;
if(this.selection.collapsed){
this.selection.updateShow(startOffset,0);
this.selection.updateShow(startOffset||this.textData[this.textData.length-1],0);
return this;
}
if(!endOffset){
......@@ -269,5 +270,9 @@ Minder.Receiver = kity.createClass('Receiver',{
setIndex:function(index){
this.index = index;
return this
},
setContainerTxt:function(txt){
this.container.textContent = txt;
return this;
}
});
\ No newline at end of file
......@@ -12,7 +12,8 @@ Minder.Selection = kity.createClass( 'Selection', {
this.timer = null;
this.collapsed = true;
this.startOffset = this.endOffset = 0;
this.setOpacity(0.5)
this.setOpacity(0.5);
this.setStyle('cursor','text');
},
collapse : function(toEnd){
......@@ -64,7 +65,7 @@ Minder.Selection = kity.createClass( 'Selection', {
this.y = offset.y;
} catch ( e ) {
console.log(e)
debugger
}
return this.update();
......
......@@ -29,7 +29,9 @@ KityMinder.registerModule( "Select", function () {
startPosition = g.snapToSharp( e.getPosition() );
},
selectMove: function ( e ) {
if(minder.isTextEditStatus()){
return;
}
if ( !startPosition ) return;
var p1 = startPosition,
......
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