package app.bvk.utils;

import javafx.scene.image.Image;
import javafx.scene.image.ImageView;

public class WrappedImageView extends ImageView {

    WrappedImageView() {
        setPreserveRatio(false);
    }

    public WrappedImageView(final Image img) {
        super(img);
        setPreserveRatio(true);
    }

    @Override
    public double maxWidth(final double height) {
        return 16384;
    }

    @Override
    public double minWidth(final double height) {
        return 40;
    }

    @Override
    public double prefWidth(final double height) {
        Image img = getImage();
        if (img == null) {
            return minWidth(height);
        }
        return img.getWidth();
    }

    @Override
    public double maxHeight(final double width) {
        return 16384;
    }

    @Override
    public double minHeight(final double width) {
        return 40;
    }

    @Override
    public double prefHeight(final double width) {
        Image img = getImage();
        if (img == null) {
            return minHeight(width);
        }
        return img.getHeight();
    }

    @Override
    public boolean isResizable() {
        return true;
    }

    @Override
    public void resize(final double width, final double height) {
        setFitWidth(width);
        setFitHeight(height);
    }
}

@@ -17,16 +17,74 @@
 utils;%0A%0A
+import org.slf4j.Logger;%0Aimport org.slf4j.LoggerFactory;%0A%0A
 import j
@@ -200,73 +200,107 @@
 w %7B%0A
+    
 %0A    
-WrappedImageView() %7B%0A        setPreserveRatio(false
+private static final Logger LOGGER = LoggerFactory.getLogger(WrappedImageView.class
 );%0A    
-%7D%0A
 %0A   
@@ -395,16 +395,236 @@
 (true);%0A
+        setOnScroll(event -%3E %7B%0A            final double amount = event.getDeltaY();%0A            scaleXProperty().add(amount);%0A            scaleYProperty().add(amount);%0A            LOGGER.debug(%22%7B%7D%22, amount);%0A        %7D);%0A
     %7D%0A%0A 
@@ -1618,20 +1618,51 @@
 ht(height);%0A
+        LOGGER.info(%22Resize%22);%0A
     %7D%0A%7D%0A

test scrolling