InteractiveImagePanel is a Java library that provides an interactive image panel that can be zoomed and moved. The image can be zoomed in and out with the mouse wheel, and moved by clicking and dragging.
- You can now select three different Image-Fit (like CSS Object-Fit) property to scale and relocate the image on component resize. [NEW]
- Zoom in and out with the mouse wheel
- Move the image by clicking and dragging
- Set the zoom level, move the image, and set the image to be displayed
- Set the maximum and minimum zoom factors
- Set the amount of zoom to be applied on each scroll with mouse wheel
- Set the image to be displayed on the panel
Add the following dependency to your pom.xml
:
<dependency>
<groupId>io.github.iso53</groupId>
<artifactId>interactive-image-panel</artifactId>
<version>2.0.0</version>
</dependency>
Here is a basic example of how to use the InteractiveImagePanel:
InteractiveImagePanel interactiveImagePanel = new InteractiveImagePanel();
interactiveImagePanel.setImage(readDummyImage());
interactiveImagePanel.addZoomCapability();
interactiveImagePanel.addMoveCapability();
interactiveImagePanel.setImageFit(ImageFit.COVER);
interactiveImagePanel.setScale(Scale.FAST);
Contributions are welcome! Feel free to open issues or pull requests.
This project is licensed under the GNU General Public License v3.0.