import org.simantics.g2d.element.ElementClass;\r
import org.simantics.g2d.element.handler.impl.BoundsOutline;\r
import org.simantics.g2d.element.handler.impl.DefaultTransform;\r
-import org.simantics.g2d.element.handler.impl.HoverImpl;\r
import org.simantics.g2d.element.handler.impl.ObjectTerminal;\r
import org.simantics.g2d.element.handler.impl.OutlinePick;\r
import org.simantics.g2d.element.handler.impl.SimpleElementLayers;\r
StaticSymbolImageInitializer.INSTANCE,\r
HoverTextElementHandler.INSTANCE,\r
BoundsOutline.INSTANCE,\r
- HoverImpl.INSTANCE,\r
+// HoverImpl.INSTANCE,\r
new WholeElementTerminals(terminals)\r
).setId(AuxiliaryFactory.class.getSimpleName());\r
}\r
\r
public static final Key SG_NODE = new SceneGraphNodeKey(TextNode.class, "TEXT_SG_NODE");\r
\r
+ private IHintListener hoverHintListener;\r
+ \r
public HoverTextElementNoBounds() {\r
super(0, 0, Alignment.LEADING, 0);\r
}\r
if(key == ElementHints.KEY_HOVER) {\r
IElement e = (IElement)sender;\r
TextNode name = (TextNode) e.getHint(SG_NODE);\r
- name.setHover(ElementUtils.isHovering(e));\r
+ name.setHover((Boolean)e.getHint(ElementHints.KEY_HOVER));\r
}\r
}\r
};\r
e.addHintListener(hoverHintListener);\r
}\r
+ \r
+ @Override\r
+ public void cleanup(IElement e) {\r
+ if(hoverHintListener != null)\r
+ e.removeHintListener(hoverHintListener);\r
+ ElementUtils.removePossibleNode(e, SG_NODE);\r
+ }\r
}
\ No newline at end of file
Font font = ElementUtils.getTextFont(e);\r
font = font.deriveFont(font.getStyle() + Font.ITALIC);\r
ElementUtils.setTextFont(e, font);\r
+ ElementUtils.setHover(e, false);\r
}\r
\r
\r
import org.simantics.g2d.element.ElementClass;\r
import org.simantics.g2d.element.handler.impl.BoundsOutline;\r
import org.simantics.g2d.element.handler.impl.DefaultTransform;\r
-import org.simantics.g2d.element.handler.impl.HoverImpl;\r
import org.simantics.g2d.element.handler.impl.ObjectTerminal;\r
import org.simantics.g2d.element.handler.impl.OutlinePick;\r
import org.simantics.g2d.element.handler.impl.SimpleElementLayers;\r
StaticSymbolImageInitializer.INSTANCE,\r
new HoverTextElementHandler(0, 0, Alignment.LEADING, 0.2f),\r
BoundsOutline.INSTANCE,\r
- HoverImpl.INSTANCE,\r
new WholeElementTerminals(terminals)\r
).setId(ModuleFactory.class.getSimpleName());\r
}\r
import org.simantics.g2d.element.ElementClass;\r
import org.simantics.g2d.element.handler.impl.BoundsOutline;\r
import org.simantics.g2d.element.handler.impl.DefaultTransform;\r
-import org.simantics.g2d.element.handler.impl.HoverImpl;\r
import org.simantics.g2d.element.handler.impl.ObjectTerminal;\r
import org.simantics.g2d.element.handler.impl.OutlinePick;\r
import org.simantics.g2d.element.handler.impl.SimpleElementLayers;\r
StaticSymbolImageInitializer.INSTANCE,\r
new HoverTextElementHandler(0, 0, Alignment.LEADING, 1f),\r
BoundsOutline.INSTANCE,\r
- HoverImpl.INSTANCE,\r
new WholeElementTerminals(terminals)\r
).setId(StockFactory.class.getSimpleName());\r
}\r
import org.simantics.g2d.canvas.ICanvasContext;\r
import org.simantics.g2d.diagram.IDiagram;\r
import org.simantics.g2d.element.ElementClass;\r
+import org.simantics.g2d.element.ElementHints;\r
import org.simantics.g2d.element.ElementUtils;\r
import org.simantics.g2d.element.IElement;\r
import org.simantics.g2d.element.handler.impl.ObjectTerminal;\r
// This synchronizes only text and transformation (not font and color)\r
e.setHint(SynchronizationHints.HINT_SYNCHRONIZER, SYNCHRONIZER);\r
\r
- ElementUtils.setHover(e, false);\r
+ e.setHint(ElementHints.KEY_HOVER, false);\r
}\r
\r
@Override\r
@Override\r
public void hintChanged(IHintObservable sender, Key key, Object oldValue, Object newValue) {\r
IElement e = (IElement)sender;\r
-// TextNode name = (TextNode) e.getHint(SG_NODE);\r
HoverShapeNode shape = (HoverShapeNode) e.getHint(NODE);\r
boolean hover = ElementUtils.isHovering(e);\r
shape.setHover(hover);\r
-// name.setHover(hover);\r
}\r
};\r
e.addHintListener(hoverHintListener);\r