Commit 5e60e28a authored by campaign's avatar campaign

修复光标

parent da286ad2
...@@ -45,7 +45,8 @@ Minder.Selection = kity.createClass( 'Selection', { ...@@ -45,7 +45,8 @@ Minder.Selection = kity.createClass( 'Selection', {
if(i === 0 || cIndex === startOffset){ if(i === 0 || cIndex === startOffset){
tmpOffset.x = o.x; tmpOffset.x = o.x;
tmpOffset.y = o.y; tmpOffset.y = o.y;
tmpOffset.width = i === 0 && offset && offset.x <= o.x && cIndex != startOffset ? 0 : o.width; tmpOffset.width = o.width;
//i === 0 && offset && offset.x <= o.x && cIndex != startOffset ? 0 :
}else if(cIndex < endOffset){ }else if(cIndex < endOffset){
tmpOffset.width += o.width; tmpOffset.width += o.width;
}else if(cIndex === endOffset){ }else if(cIndex === endOffset){
...@@ -54,7 +55,6 @@ Minder.Selection = kity.createClass( 'Selection', { ...@@ -54,7 +55,6 @@ Minder.Selection = kity.createClass( 'Selection', {
} }
cIndex++; cIndex++;
}); });
if(tmpOffset.x !== undefined) { if(tmpOffset.x !== undefined) {
arrOffset.push(tmpOffset); arrOffset.push(tmpOffset);
......
...@@ -38,29 +38,34 @@ var TextRenderer = KityMinder.TextRenderer = kity.createClass('TextRenderer', { ...@@ -38,29 +38,34 @@ var TextRenderer = KityMinder.TextRenderer = kity.createClass('TextRenderer', {
this.setTextStyle(node, textGroup); this.setTextStyle(node, textGroup);
for (var i = 0, text, textShape; var textLength = textArr.length;
(text = textArr[i], textShape = textGroup.getItem(i),
text !== undefined || textShape !== undefined); i++) { var textGroupLength = textGroup.getItems().length;
if (text === undefined && textShape) { if(textLength < textGroupLength){
for( var i = textLength,ci;ci = textGroup.getItem(i);){
textGroup.removeItem(i); textGroup.removeItem(i);
} else { }
if (text !== undefined && !textShape) { }else if(textLength > textGroupLength){
textShape = new kity.Text() var length = textLength - textGroupLength;
.setAttr('text-rendering', 'inherit'); for(var i = 0;i < length;i++){
if (kity.Browser.ie) { var textShape = new kity.Text()
textShape.setVerticalAlign('top'); .setAttr('text-rendering', 'inherit');
} else { if (kity.Browser.ie) {
textShape.setAttr('dominant-baseline', 'text-before-edge'); textShape.setVerticalAlign('top');
} } else {
textGroup.addItem(textShape); textShape.setAttr('dominant-baseline', 'text-before-edge');
} }
textShape.setContent(text); textGroup.addItem(textShape);
} }
}
for (var i = 0, text, textShape;
(text = textArr[i], textShape = textGroup.getItem(i)); i++) {
textShape.setContent(text);
} }
this.setTextStyle(node, textGroup); this.setTextStyle(node, textGroup);
return function() { return function() {
......
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