Module MaterialFX

Class MFXMagnifierPaneSkin

java.lang.Object
javafx.scene.control.SkinBase<MFXMagnifierPane>
io.github.palexdev.materialfx.skins.MFXMagnifierPaneSkin
All Implemented Interfaces:
Skin<MFXMagnifierPane>

public class MFXMagnifierPaneSkin extends SkinBase<MFXMagnifierPane>
This is the default skin implementation for MFXMagnifierPane.

There are three main components:

1) The lens container: the magnifier's lens is wrapped in a top container to allow clipping the lens (to make it a circle) while still keeping the lens border

2) The lens: core component of the magnifier, responsible for showing a portion of the content zoomed by the current zoom level, MFXMagnifierPane.zoomProperty(), more about this component here MFXMagnifierPaneSkin.MFXMagnifierLens

3) The color picker: an extra functionality of the magnifier. To be precise the color picker is just an HBox containing a square and a label. I decided to implement it because the actual "color picking" functionality is already available as part of the magnifier, more here MFXMagnifierPaneSkin.ColorPicker

The layout is quite complex and delicate as there is a lot to take in consideration, every component is controlled manually. The lens position for example can't just be the current mouse position, ideally the mouse should be at the center of the lens, for this reason the lens' positions must be shifted according to it's size and zoom level. The lens' view is also a delicate "topic", since the lens is translated, the captured image must be adjusted too, always taking into account the zoom level of course.
  • Constructor Details

    • MFXMagnifierPaneSkin

      public MFXMagnifierPaneSkin(MFXMagnifierPane magnifier)
  • Method Details

    • layoutChildren

      protected void layoutChildren(double contentX, double contentY, double contentWidth, double contentHeight)
      Overrides:
      layoutChildren in class SkinBase<MFXMagnifierPane>