From fb06141f5694122586d8f823fa2ebfd8308de512 Mon Sep 17 00:00:00 2001 From: Nicolas Roduit Date: Fri, 20 Dec 2024 17:18:34 +0100 Subject: [PATCH] Fix recenter crossline when zooming. Fix image position when resizing the canvas. --- .../org/weasis/core/ui/editor/image/ImageViewerPlugin.java | 6 +++--- .../src/main/java/org/weasis/dicom/viewer2d/View2d.java | 2 ++ .../main/java/org/weasis/dicom/viewer2d/mpr/MprView.java | 6 ++++++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/weasis-core/src/main/java/org/weasis/core/ui/editor/image/ImageViewerPlugin.java b/weasis-core/src/main/java/org/weasis/core/ui/editor/image/ImageViewerPlugin.java index 181724bd8..e7d8d2ef3 100755 --- a/weasis-core/src/main/java/org/weasis/core/ui/editor/image/ImageViewerPlugin.java +++ b/weasis-core/src/main/java/org/weasis/core/ui/editor/image/ImageViewerPlugin.java @@ -508,7 +508,7 @@ public void replaceView(ViewCanvas oldView2d, ViewCanvas newView2d) { if (!view2ds.isEmpty()) { if (selectedImagePane == null) { - selectedImagePane = view2ds.get(0); + selectedImagePane = view2ds.getFirst(); } MouseActions mouseActions = eventManager.getMouseActions(); boolean tiledMode = SynchData.Mode.TILE.equals(synchView.getSynchData().getMode()); @@ -661,9 +661,9 @@ public void windowClosing(WindowEvent e) { fullscreenDialog.removeAll(); fullscreenDialog.dispose(); add(grid, BorderLayout.CENTER); - } - defaultView2d.getJComponent().requestFocusInWindow(); + defaultView2d.getJComponent().requestFocusInWindow(); + } } /** Return the image in the image display panel. */ diff --git a/weasis-dicom/weasis-dicom-viewer2d/src/main/java/org/weasis/dicom/viewer2d/View2d.java b/weasis-dicom/weasis-dicom-viewer2d/src/main/java/org/weasis/dicom/viewer2d/View2d.java index 8d5b6c8b3..fd5dd7812 100755 --- a/weasis-dicom/weasis-dicom-viewer2d/src/main/java/org/weasis/dicom/viewer2d/View2d.java +++ b/weasis-dicom/weasis-dicom-viewer2d/src/main/java/org/weasis/dicom/viewer2d/View2d.java @@ -177,6 +177,8 @@ private void componentResized() { */ if (currentZoom <= 0.0) { zoom(0.0); + } else { + zoom(currentZoom); } if (panner != null) { panner.updateImageSize(); diff --git a/weasis-dicom/weasis-dicom-viewer2d/src/main/java/org/weasis/dicom/viewer2d/mpr/MprView.java b/weasis-dicom/weasis-dicom-viewer2d/src/main/java/org/weasis/dicom/viewer2d/mpr/MprView.java index 50f9f6ec9..06085809b 100755 --- a/weasis-dicom/weasis-dicom-viewer2d/src/main/java/org/weasis/dicom/viewer2d/mpr/MprView.java +++ b/weasis-dicom/weasis-dicom-viewer2d/src/main/java/org/weasis/dicom/viewer2d/mpr/MprView.java @@ -222,6 +222,12 @@ public void propertyChange(PropertyChangeEvent evt) { // } } + @Override + public void zoom(Double viewScale) { + super.zoom(viewScale); + computeCrosslines(0); + } + @Override protected void drawOnTop(Graphics2D g2d) { MprAxis axis = getMprAxis();