private void kochPanelMouseClicked(MouseEvent event) { if (Math.abs(event.getX() - startPressedX) < 1.0 && Math.abs(event.getY() - startPressedY) < 1.0) { double originalPointClickedX = (event.getX() - zoomTranslateX) / zoom; double originalPointClickedY = (event.getY() - zoomTranslateY) / zoom; if (event.getButton() == MouseButton.PRIMARY) { zoom *= 2.0; } else if (event.getButton() == MouseButton.SECONDARY) { zoom /= 2.0; } zoomTranslateX = (int) (event.getX() - originalPointClickedX * zoom); zoomTranslateY = (int) (event.getY() - originalPointClickedY * zoom); kochManager.drawEdges(); } }
@Override public void eventMouse(MouseEvent e) { if (!this.isVisible()) { this.state = NORMAL; return; } int button = e.getButton(); boolean state = e.getState(); Vec2i mouse = new Vec2i(e.getX(), e.getY()); if (this.getBoundsDisp().contains(mouse)) { if (!state) { if (this.state == PRESSED && button == BUTTON_LEFT) { this.clicked = true; this.state = MOUSE_ON; } if (this.state == NORMAL) { this.state = MOUSE_ON; } } else if (button == BUTTON_LEFT) { this.state = PRESSED; } } else { this.state = NORMAL; } }
public static void openProducedItemDescription( final MouseEvent e, final RecipeView recipeView, final Window window) { if (e.getButton() != 3) { return; } final UICraftItemDetailMessage msg = new UICraftItemDetailMessage(); msg.setParentWindowId((window == null) ? null : window.getElementMap().getId()); msg.setItem(recipeView); Worker.getInstance().pushMessage(msg); }
public static void openProducedItemDescription( final MouseEvent e, final AbstractCraftHarvestElement element, final Window window) { if (e.getButton() != 3) { return; } final AbstractReferenceItem referenceItem = ReferenceItemManager.getInstance().getReferenceItem(element.getItemId()); if (referenceItem == null) { return; } final Item item = new Item(referenceItem.getId()); item.initializeWithReferenceItem(referenceItem); final UIItemDetailMessage msg = new UIItemDetailMessage(); msg.setId(16415); msg.setParentWindowId((window == null) ? null : window.getElementMap().getId()); msg.setItem(item); Worker.getInstance().pushMessage(msg); }