@Override
    public void handle(ScrollEvent e) {
        if (e.isControlDown()) {
            double actualScale = canvas.getScaleX();
            
            if (actualScale > MAX_SCALE || actualScale < MIN_SCALE) {
                e.consume();
                return;
            }
            
            double hVal = scrollPane.getHvalue();
            double vVal = scrollPane.getVvalue();
            
            double scale, factor;           
            if (e.getDeltaY() > 0) { // nahoru
                factor = 1.1;
            } else {
                factor = 0.9;
            }
            scale = actualScale * factor;
            
            scale = Math.min(scale, MAX_SCALE);
            scale = Math.max(scale, MIN_SCALE);
            
            canvas.setScaleX(scale);
            canvas.setScaleY(scale);

            scrollPane.setHvalue(hVal);
            scrollPane.setVvalue(vVal);

            e.consume();
        }
    }