Commit 46595032 authored by campaign's avatar campaign

添加光标的主题和修复粘贴节点死循环问题

parent 3af6dcd7
......@@ -19,12 +19,16 @@ KityMinder.registerModule('TextEditModule', function() {
function inputStatusReady(node){
if (node && km.isSingleSelect() && node.isSelected()) {
var color = node.getStyle('text-selection-color');
//准备输入状态
var textShape = node.getTextShape();
sel.setHide()
.setStartOffset(0)
.setEndOffset(textShape.getContent().length);
.setEndOffset(textShape.getContent().length)
.setColor(color);
receiver
.setMinderNode(node)
......@@ -78,7 +82,7 @@ KityMinder.registerModule('TextEditModule', function() {
textShape.setStyle('cursor', 'default');
if (this.isSingleSelect() && node.isSelected()) {
sel.collapse();
sel.setColor(node.getStyle('text-selection-color'));
receiver
.setMinderNode(node)
......@@ -138,6 +142,8 @@ KityMinder.registerModule('TextEditModule', function() {
sel.collapse();
sel.setColor(node.getStyle('text-selection-color'));
node.getTextShape().setStyle('cursor', 'text');
receiver.updateSelection();
......@@ -234,9 +240,9 @@ KityMinder.registerModule('TextEditModule', function() {
km.setStatus('normal');
receiver.clear();
},
'blur': function() {
receiver.clear();
},
// 'blur': function() {
// receiver.clear();
// },
'import': function() {
km.setStatus('normal');
receiver.clear();
......
......@@ -17,9 +17,13 @@ Minder.Selection = kity.createClass( 'Selection', {
this._show = false;
},
setColor:function(color){
this.stroke(color);
this.fill(color);
},
collapse : function(toEnd){
this.stroke( 'rgb(27,171,255)', 1 );
// this.stroke( 'rgb(27,171,255)', 1 );
this.setOpacity(1);
this.width = 1;
this.collapsed = true;
......@@ -105,6 +109,7 @@ Minder.Selection = kity.createClass( 'Selection', {
clearInterval( this.timer );
var me = this,
state = '';
me.setStyle( 'display', '' );
me._show = true;
if(this.collapsed){
......
......@@ -53,7 +53,7 @@ KityMinder.registerModule( "pasteModule", function () {
if(node){
km.fire('saveScene');
for(var i= 0,ni;ni=_cacheNodes[i++];){
appendChildNode(node,ni);
appendChildNode(node,ni.clone());
}
km.layout(300);
km.select(_selectedNodes,true);
......
......@@ -49,5 +49,7 @@ KityMinder.registerTheme('classic', {
'order-hint-area-color': 'rgba(0, 255, 0, .5)',
'order-hint-path-color': '#0f0',
'order-hint-path-width': 1
'order-hint-path-width': 1,
'text-selection-color': 'rgb(27,171,255)'
});
\ No newline at end of file
......@@ -4,6 +4,7 @@
}
function generate(h) {
var textSelectionColor = kity.Color.parse('rgb(27,171,255)');
return {
'background': '#fbfbfb',
......@@ -15,6 +16,7 @@
'root-margin': [30, 100],
'root-radius': 5,
'root-space': 10,
'root-text-selection-color': textSelectionColor.set('h', h).set('l', 20),
'main-color': 'black',
......@@ -52,7 +54,9 @@
'order-hint-area-color': hsl(h, 100, 95).set('a', 0.5),
'order-hint-path-color': hsl(h, 100, 25),
'order-hint-path-width': 1
'order-hint-path-width': 1,
'text-selection-color': textSelectionColor.set('h', h)
};
}
......
......@@ -47,5 +47,7 @@ KityMinder.registerTheme('snow', {
'order-hint-area-color': 'rgba(0, 255, 0, .5)',
'order-hint-path-color': '#0f0',
'order-hint-path-width': 1
'order-hint-path-width': 1,
'text-selection-color': 'rgb(27,171,255)'
});
\ No newline at end of file
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