use of com.ait.lienzo.client.core.event.NodeDragStartEvent 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.NodeDragStartEvent 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;
}
}
use of com.ait.lienzo.client.core.event.NodeDragStartEvent in project lienzo-core by ahome-it.
the class LienzoHandlerManager method doDragStart.
private final void doDragStart(final IPrimitive<?> node, final INodeXYEvent event) {
if (m_dragging) {
doDragCancel(event);
}
Cursor cursor = m_lienzo.getSelectCursor();
if (null == cursor) {
cursor = LienzoCore.get().getDefaultSelectCursor();
if (null == cursor) {
cursor = Cursor.CROSSHAIR;
}
}
m_lienzo.setCursor(cursor);
m_drag_node = node;
m_drag_mode = node.getDragMode();
m_dragContext = new DragContext(event, node, m_viewport.getTransform().getInverse());
m_drag_node.setDragging(true);
m_drag_node.fireEvent(new NodeDragStartEvent(m_dragContext));
m_dragging = true;
if (DragMode.DRAG_LAYER == m_drag_mode) {
m_drag_node.setVisible(false);
m_drag_node.getLayer().draw();
m_dragContext.drawNodeWithTransforms(m_lienzo.getDragLayer().getContext());
}
m_dragging_dispatch_move = m_drag_node.isEventHandled(NodeDragMoveEvent.getType());
m_dragging_using_touches = ((event.getNodeEvent().getAssociatedType() == NodeTouchMoveEvent.getType()) || (event.getNodeEvent().getAssociatedType() == NodeTouchStartEvent.getType()));
}
Aggregations