public List<Integer> getHandlePointIndexList(MouseEventDouble mouseEvent) { Map<Double, Integer> indexByDistanceMap = new TreeMap<>(); final Point2D mousePoint = Optional.ofNullable(mouseEvent).map(evt -> evt.getImageCoordinates()).orElse(null); if (mousePoint != null && !pts.isEmpty() && !layer.getLocked()) { double maxHandleDistance = HANDLE_SIZE * 1.5 / GeomUtil.extractScalingFactor(getAffineTransform(mouseEvent)); for (int index = 0; index < pts.size(); index++) { Point2D handlePoint = pts.get(index); double handleDistance = (handlePoint != null) ? mousePoint.distance(handlePoint) : Double.MAX_VALUE; if (handleDistance <= maxHandleDistance) { indexByDistanceMap.put(handleDistance, index); } } } return (!indexByDistanceMap.isEmpty()) ? new ArrayList<>(indexByDistanceMap.values()) : null; }
/** * @return selected handle point index if exist, otherwise -1 */ @Override public int getHandlePointIndex(MouseEventDouble mouseEvent) { int nearestHandlePtIndex = -1; final Point2D mousePoint = Optional.ofNullable(mouseEvent).map(evt -> evt.getImageCoordinates()).orElse(null); if (mousePoint != null && !pts.isEmpty() && !layer.getLocked()) { double minHandleDistance = Double.MAX_VALUE; double maxHandleDistance = HANDLE_SIZE * 1.5 / GeomUtil.extractScalingFactor(getAffineTransform(mouseEvent)); for (int index = 0; index < pts.size(); index++) { Point2D handlePoint = pts.get(index); double handleDistance = Optional.ofNullable(handlePoint).map(mousePoint::distance).orElse(Double.MAX_VALUE); if (handleDistance <= maxHandleDistance && handleDistance < minHandleDistance) { minHandleDistance = handleDistance; nearestHandlePtIndex = index; } } } return nearestHandlePtIndex; }
&& !firstGraphicIntersecting.get().getLayer().getLocked()) { DragGraphic dragGraph = (DragGraphic) firstGraphicIntersecting.get(); List<DragGraphic> selectedDragGraphList = vImg.getGraphicManager().getSelectedDragableGraphics();
&& !firstGraphicIntersecting.get().getLayer().getLocked()) { DragGraphic dragGraph = (DragGraphic) firstGraphicIntersecting.get();
DragGraphic dragGraph = (DragGraphic) firstGraphicIntersecting.get(); List<DragGraphic> selectedDragGraphList = graphicList.getSelectedDragableGraphics(); boolean locked = dragGraph.getLayer().getLocked(); && selectedDragGraphList.stream().allMatch(g -> !g.getLayer().getLocked())) { ds = new BulkDragSequence(selectedDragGraphList, mouseEvt); newCursor = cursorSet.getMoveCursor();