X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.diagram%2Fsrc%2Forg%2Fsimantics%2Fdiagram%2Felements%2FTextNode.java;h=7c684f30b372b6d915baa9c74f7bb4c675856720;hb=569d9bd9d6a270e8ede5867ff0b1f13475047e8b;hp=77eb789220d3118e5d8c370c2889b731450e060f;hpb=0a576ec54b7f4b3e391526d22a86c9410e4f5378;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.diagram/src/org/simantics/diagram/elements/TextNode.java b/bundles/org.simantics.diagram/src/org/simantics/diagram/elements/TextNode.java index 77eb78922..7c684f30b 100644 --- a/bundles/org.simantics.diagram/src/org/simantics/diagram/elements/TextNode.java +++ b/bundles/org.simantics.diagram/src/org/simantics/diagram/elements/TextNode.java @@ -403,7 +403,7 @@ public class TextNode extends G2DNode implements IDynamicSelectionPainterNode, L if (hasState(STATE_EDITING)) return; - this.text = new String(text != null ? text : ""); + this.text = text; this.font = font; this.color = color; this.scale = scale; @@ -470,8 +470,8 @@ public class TextNode extends G2DNode implements IDynamicSelectionPainterNode, L // no value => value if(this.text == null && text != null) NodeUtil.decreasePending(this); - this.text = text != null ? text : ""; - caret = Math.min(caret, this.text.length()); + this.text = text; + caret = text != null ? Math.min(caret, text.length()) : 0; selectionTail = caret; resetCaches(); @@ -632,7 +632,7 @@ public class TextNode extends G2DNode implements IDynamicSelectionPainterNode, L boolean hover = hasState(STATE_HOVER); boolean editing = hasState(STATE_EDITING); - if (!isSelected && hover) { + if (!isSelected && hover && textListener != null) { color = add(color, 120, 120, 120); }