private void updateSelectionArea() { float x1 = (float) this.currentSelectionAreaStart.getX(); float y1 = (float) this.currentSelectionAreaStart.getY(); float x2 = (float) this.currentSelectionAreaEnd.getX(); float y2 = (float) this.currentSelectionAreaEnd.getY(); selectionAreaBuffer.putFloat(x1); selectionAreaBuffer.putFloat(y1); selectionAreaBuffer.putFloat(x2); selectionAreaBuffer.putFloat(y1); selectionAreaBuffer.putFloat(x2); selectionAreaBuffer.putFloat(y2); selectionAreaBuffer.putFloat(x1); selectionAreaBuffer.putFloat(y2); }
private UIPoint convertToLocal(MouseEvent e) { return new UIPoint(e.getX() * scaleFactor, (e.getComponent().getHeight() - e.getY()) * scaleFactor); }
public GOEventHandlerImplementation(UIPoint lastpoint) { last = toMapPosition(lastpoint); firerer.fireAction(new StartDrawingAction(last)); starty = lastpoint.getY(); }
/** * Handles a mouse event somewhere in the area and passes it on to the region. * * @param event * The event. */ private void handleMouseEvent(GODrawEvent event) { GODrawEventProxy displacedEvent = new GODrawEventProxy(event, new UIPoint(0, 0)); region.handleEvent(displacedEvent); }
@Override public void eventDataChanged(GOEvent event) { UIPoint pos = ((GODrawEvent) event).getDrawPosition(); ShortPoint2D cur = toMapPosition(pos); firerer.fireAction(new DrawLineAction(last, cur, pos.getY() - starty)); last = cur; } }
/** * Sets the temporary pan progress for a given pan operation. * * @param key * The identifier of the event * @param distance * The actual distance when the event ended. */ public synchronized void finishPanProgress(Object key, UIPoint distance) { this.panProgresses.remove(key); setScreenCenter((int) (this.screenCenterX - distance.getX() / zoom), (int) (this.screenCenterY - distance.getY() / zoom)); }
@Override public void invoke(long window, double xpos, double ypos) { last_point = new UIPoint(xpos, height - ypos); updateHoverPosition(last_point); if(presstime+0.1<GLFW.glfwGetTime()) { updatePanPosition(last_point); updateDrawPosition(last_point); } } };
/** * Sets the mouse position as a given point. * * @param current * The position. */ protected void setMousePosition(final UIPoint current) { if (this.position != null) { mouseMoved += Math.abs(current.getX() - this.position.getX()) + Math.abs(current.getY() - this.position.getY()); } this.position = current; if (getPhase() == PHASE_MODAL) { fireModalDataRefreshed(); } } }
/** * Creates a new pan handler. * * @param context * The screen position this handler should be apply to. */ public PanHandler(ScreenPosition context) { this.context = context; context.setPanProgress(this, new UIPoint(0, 0)); }
public PseudoPanEvent(GOEvent event, int x, int y) { event.setHandler(this); this.distance = new UIPoint(x, y); this.dx = x; this.dy = y; }
@Override public void aborted(GOEvent event) { this.context.finishPanProgress(this, new UIPoint(0, 0)); }