@Override public boolean processMouseDown(MouseDownEvent event) { JavaScriptObject target = event.getNativeEvent().getEventTarget(); m = g.getScreenCTM().inverse(); delta = getCoordinates(event, m); float x = posHandle.getX().getBaseVal().getValue(); float y = posHandle.getY().getBaseVal().getValue(); float width = posHandle.getWidth().getBaseVal().getValue(); float height = posHandle.getHeight().getBaseVal().getValue(); OMSVGPoint p = svg.createSVGPoint(); if (target == posHandle.getElement()) { mode = Mode.POS; p.setX(x); p.setY(y); } else if (target == topLeftHandle.getElement()) { p.setX(x); p.setY(y); mode = Mode.TOP_LEFT; } else if (target == bottomRightHandle.getElement()) { p.setX(x + width); p.setY(y + height); mode = Mode.BOTTOM_RIGHT; } if (mode.consumeEvent()) { delta.substract(p); event.preventDefault(); event.stopPropagation(); } return true; }
public void onMouseDown(MouseDownEvent event) { setMouseDown(true); updateCSS(); DOM.setCapture(view.getElement()); dragStartX = event.getX(); dragStartY = event.getY(); event.preventDefault(); }
public void onMouseDown(@Nonnull final MouseDownEvent event) { dragging = true; // capturing the mouse to the dragged widget. DOM.setCapture(container.getElement()); startY = event.getY(); ClientLog.log("DOWN", null); event.stopPropagation(); event.preventDefault(); originalStyle = widget.getElement().getAttribute("style"); }
@Override public void onMouseDown(MouseDownEvent event) { // if (getWidget().getClass() != RootPanel.class) // getWidget().setFocus(true); event.preventDefault(); event.stopPropagation(); if (this.activeLook) { switch (event.getNativeButton()) { case NativeEvent.BUTTON_LEFT: this.moveForward = true; break; case NativeEvent.BUTTON_RIGHT: this.moveBackward = true; break; } } }
public void onMouseDown(MouseDownEvent event) { startX = event.getClientX(); startY = event.getClientY(); if (isDisabled() || event.getNativeButton() != NativeEvent.BUTTON_LEFT) { return; } clickTarget = Element.as(event.getNativeEvent().getEventTarget()); mouseMoveCanceled = false; if (weekGrid.getCalendar().isEventMoveAllowed() || clickTargetsResize()) { moveRegistration = addMouseMoveHandler(this); setFocus(true); try { startYrelative = (int) ((double) event.getRelativeY(caption) % slotHeight); startXrelative = (event.getRelativeX(weekGrid.getElement()) - weekGrid.timebar.getOffsetWidth()) % getDateCellWidth(); } catch (Exception e) { GWT.log("Exception calculating relative start position", e); } mouseMoveStarted = false; Style s = getElement().getStyle(); s.setZIndex(1000); startDatetimeFrom = (Date) calendarEvent.getStartTime().clone(); startDatetimeTo = (Date) calendarEvent.getEndTime().clone(); Event.setCapture(getElement()); } // make sure the right cursor is always displayed if (clickTargetsResize()) { addGlobalResizeStyle(); } /* * We need to stop the event propagation or else the WeekGrid * range select will kick in */ event.stopPropagation(); event.preventDefault(); }
public void onMouseDown(MouseDownEvent e) { GPoint p = table.getIndexFromPixel(e.getClientX(), e.getClientY()); if (p.getY() == 0 && p.getX() > 0) { if (table.isEditing()) editor.cancelCellEditing(); table.scc.onMouseDown(e); return; } else if (p.getX() == 0 && p.getY() > 0) { if (table.isEditing()) editor.cancelCellEditing(); table.srh.onMouseDown(e); return; } // if (!view.hasViewFocus()) // ((LayoutW) app.getGuiManager().getLayout()).getDockManager() // .setFocusedPanel(App.VIEW_SPREADSHEET); view.requestFocus(); mouseIsDown = true; e.preventDefault(); boolean eConsumed = false; boolean rightClick = (e.getNativeButton() == NativeEvent.BUTTON_RIGHT); // tell selection listener about click on GeoElement if (!rightClick && app.getMode() == EuclidianConstants.MODE_SELECTION_LISTENER) { int row = p.getY(); // ?//table.rowAtPoint(e.getPoint()); int col = p.getX(); // ?//table.columnAtPoint(e.getPoint()); GeoElement geo = (GeoElement) model.getValueAt(row - 1, col - 1); // double click or empty geo if (geo != null) { // tell selection listener about click app.geoElementSelected(geo, false); return; } } if (!rightClick) { // memory testing // Application.debug("", true, true, 0); if (table.getSelectionType() != MyTable.CELL_SELECT) { table.setSelectionType(MyTable.CELL_SELECT); } // force column selection if (view.isColumnSelect()) { GPoint point = table.getIndexFromPixel(e.getClientX(), e.getClientY()); if (point != null) { int column = point.getX(); table.setColumnSelectionInterval(column, column); } } /* * if (MyTable.this.getSelectionModel().getSelectionMode() != * ListSelectionModel.SINGLE_INTERVAL_SELECTION) { * setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION); * setColumnSelectionAllowed(true); setRowSelectionAllowed(true); } */ GPoint point1 = table.getMaxSelectionPixel(); if (point1 == null) return; // Handle click in another cell while editing a cell: // if the edit string begins with "=" then the clicked cell name // is inserted into the edit text if (editor.isEditing()) { String text = editor.getEditingValue(); if (text.startsWith("=")) { GPoint point = table.getIndexFromPixel(e.getClientX(), e.getClientY()); if (point != null && (point.getX() != editor.column || point.getY() != editor.row)) { // in Web, it's necessary to distinguish the editor row and column // because the event is not catched and not taken by the textfield int column = point.getX(); int row = point.getY(); GeoElement geo = RelativeCopy.getValue(app, column - 1, row - 1); if (geo != null) { // get cell name String name = GeoElementSpreadsheet.getSpreadsheetCellName(column - 1, row - 1); if (geo.isGeoFunction()) name += "(x)"; selectedCellName = name; // get prefix/post substrings for current text caret // position int caretPos = editor.getCaretPosition(); prefix0 = text.substring(0, caretPos); postfix0 = text.substring(caretPos, text.length()); table.isDragging2 = true; table.minColumn2 = column; table.maxColumn2 = column; table.minRow2 = row; table.maxRow2 = row; // insert the geo label into the editor string editor.addLabel(name); eConsumed = true; table.repaint(); } eConsumed = true; } } else { // if text does not start with "=" then stop the editor // and allow it to create/redefine a geo here editor.setAllowProcessGeo(true); editor.stopCellEditing(); editor.setAllowProcessGeo(false); table.finishEditing(); // almost like MyCellEditorW.stopCellEditing(int,int) } } else if (table.isOverDot) { table.isDragingDot = true; eConsumed = true; } } if (eConsumed) return; // MyTable's default listeners follow, they should be simulated in Web e.g. here // change selection if right click is outside current selection if (p.getY() != table.anchorSelectionRow + 1 || p.getX() != table.anchorSelectionColumn + 1) { // switch to cell selection mode if (p.getY() > 0 && p.getX() > 0) { if (table.getSelectionType() != MyTable.CELL_SELECT) { table.setSelectionType(MyTable.CELL_SELECT); } // now change the selection table.changeSelection(p.getY() - 1, p.getX() - 1, false, false); table.repaint(); } } }