Commit 46595032 authored by campaign's avatar campaign

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

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