use of com.ait.lienzo.client.core.event.NodeDragMoveEvent in project lienzo-core by ahome-it.
the class LienzoHandlerManager method doDragMove.
private final void doDragMove(final INodeXYEvent event) {
m_dragContext.dragUpdate(event);
if (m_dragging_dispatch_move) {
m_drag_node.fireEvent(new NodeDragMoveEvent(m_dragContext));
}
if (DragMode.DRAG_LAYER == m_drag_mode) {
m_lienzo.getDragLayer().draw();
m_dragContext.drawNodeWithTransforms(m_lienzo.getDragLayer().getContext());
} else {
m_drag_node.getLayer().batch();
}
}
use of com.ait.lienzo.client.core.event.NodeDragMoveEvent in project kie-wb-common by kiegroup.
the class DecisionServiceSVGShapeViewTest method setup.
@Before
@SuppressWarnings("unchecked")
public void setup() {
when(svgPrimitive.get()).thenReturn(shape);
when(shape.getAttributes()).thenReturn(attributes);
when(shape.asNode()).thenReturn(shapeNode);
when(attributes.getDouble(Attribute.WIDTH.getProperty())).thenReturn(WIDTH);
when(attributes.getDouble(Attribute.HEIGHT.getProperty())).thenReturn(HEIGHT);
this.nodeDragStartEvent = new NodeDragStartEvent(dragContext);
this.nodeDragMoveEvent = new NodeDragMoveEvent(dragContext);
this.nodeDragEndEvent = new NodeDragEndEvent(dragContext);
this.view = new DecisionServiceSVGShapeView("name", svgPrimitive, WIDTH, HEIGHT, true);
}
use of com.ait.lienzo.client.core.event.NodeDragMoveEvent in project drools-wb by kiegroup.
the class RadarMenuViewImpl method setup.
@PostConstruct
public void setup() {
radarCanvas.add(radarLayer);
radarMenuDropdown.setTitle(translationService.getTranslation(GuidedDecisionTableErraiConstants.RowContextMenuViewImpl_Title));
visibleBounds.setDraggable(true);
visibleBounds.addNodeDragMoveHandler(new NodeDragMoveHandler() {
@Override
public void onNodeDragMove(final NodeDragMoveEvent event) {
presenter.onDragVisibleBounds(visibleBounds.getX(), visibleBounds.getY());
}
});
visibleBounds.setFillColor(ColorName.GRAY);
visibleBounds.setAlpha(0.25);
visibleBounds.setLocation(new Point2D((RADAR_WIDTH - visibleBounds.getWidth()) / 2, (RADAR_HEIGHT - visibleBounds.getHeight()) / 2));
radarLayer.add(visibleBounds);
radarCanvas.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
if (eventTargetsPopup(event.getNativeEvent(), radarMenu)) {
event.stopPropagation();
event.preventDefault();
}
}
private boolean eventTargetsPopup(final NativeEvent event, final Element element) {
final EventTarget target = event.getEventTarget();
if (Element.is(target)) {
return element.isOrHasChild(Element.as(target));
}
return false;
}
});
}
use of com.ait.lienzo.client.core.event.NodeDragMoveEvent in project lienzo-core by ahome-it.
the class WiresContainer method ensureHandlers.
private void ensureHandlers() {
if (!m_drag_initialized && (null != m_container)) {
m_registrationManager.register(m_container.addNodeDragStartHandler(new NodeDragStartHandler() {
@Override
public void onNodeDragStart(final NodeDragStartEvent event) {
WiresContainer.this.m_dragging = true;
m_events.fireEvent(new WiresDragStartEvent(WiresContainer.this, event));
}
}));
m_registrationManager.register(m_container.addNodeDragMoveHandler(new NodeDragMoveHandler() {
@Override
public void onNodeDragMove(final NodeDragMoveEvent event) {
WiresContainer.this.m_dragging = true;
m_events.fireEvent(new WiresDragMoveEvent(WiresContainer.this, event));
}
}));
m_registrationManager.register(m_container.addNodeDragEndHandler(new NodeDragEndHandler() {
@Override
public void onNodeDragEnd(final NodeDragEndEvent event) {
WiresContainer.this.m_dragging = false;
m_events.fireEvent(new WiresDragEndEvent(WiresContainer.this, event));
}
}));
m_container.setAttributesChangedBatcher(m_attributesChangedBatcher);
final AttributesChangedHandler handler = new AttributesChangedHandler() {
@Override
public void onAttributesChanged(final AttributesChangedEvent event) {
if (!WiresContainer.this.m_dragging && event.evaluate(XYWH_OP)) {
fireMove();
}
}
};
// Attribute change handlers.
m_registrationManager.register(m_container.addAttributesChangedHandler(Attribute.X, handler));
m_registrationManager.register(m_container.addAttributesChangedHandler(Attribute.Y, handler));
m_drag_initialized = true;
}
}
Aggregations