LayerInteractionManager class
A helper class responsible for managing layer interactions in the editor.
The LayerInteractionManager
class provides methods for handling various interactions
with layers in an image editing environment, including scaling, rotating, flipping,
and zooming. It also manages the display of helper lines and provides haptic feedback
when interacting with these lines to enhance the user experience.
Constructors
Properties
- baseAngleFactor ↔ double
-
The base angle factor for the editor.
getter/setter pair
- baseScaleFactor ↔ double
-
The base scale factor for the editor.
getter/setter pair
- deviceCanCustomVibrate ↔ bool
-
Flag indicating if the device can perform custom vibration.
getter/setter pair
- deviceCanVibrate ↔ bool
-
Flag indicating if the device can vibrate.
getter/setter pair
- enabledHitDetection ↔ bool
-
Enables or disables hit detection.
When
true
, allows detecting user interactions with the painted layer.getter/setter pair - freeStyleHighPerformance → bool
-
no setter
- freeStyleHighPerformanceEditorZoom ↔ bool
-
Controls high-performance for layers when editor zoom.
getter/setter pair
- freeStyleHighPerformanceHero ↔ bool
-
Controls high-performance hero animation for free-style drawing.
When
true
, enables optimized hero-animation for improved performance.getter/setter pair - freeStyleHighPerformanceMoving ↔ bool
-
Controls high-performance moving for free-style drawing.
When
true
, enables optimized moving for improved performance.getter/setter pair - freeStyleHighPerformanceScaling ↔ bool
-
Controls high-performance scaling for free-style drawing.
When
true
, enables optimized scaling for improved performance.getter/setter pair - hashCode → int
-
The hash code for this object.
no setterinherited
- hitSpan → double
-
Span for detecting hits on layers.
final
- hoverRemoveBtn ↔ bool
-
Flag indicating if the remove button is hovered.
getter/setter pair
- lastPositionX ↔ LayerLastPosition
-
Last recorded X-axis position for layers.
getter/setter pair
- lastPositionY ↔ LayerLastPosition
-
Last recorded Y-axis position for layers.
getter/setter pair
- rotateScaleLayerScaleHelper ↔ double?
-
Helper variable for scaling during rotation of a layer.
getter/setter pair
- rotateScaleLayerSizeHelper ↔ Size?
-
Helper variable for storing the size of a layer during rotation and scaling operations.
getter/setter pair
- rotationHelperLineDeg ↔ double
-
Rotation angle of the rotation helper line.
getter/setter pair
- rotationHelperLineX ↔ double
-
X-coordinate of the rotation helper line.
getter/setter pair
- rotationHelperLineY ↔ double
-
Y-coordinate of the rotation helper line.
getter/setter pair
- rotationStartedHelper ↔ bool
-
Flag indicating if rotation helper lines have started.
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- scaleDebounce ↔ Debounce
-
Debounce for scaling actions in the editor.
getter/setter pair
- selectedLayerId ↔ String
-
The ID of the currently selected layer.
getter/setter pair
- showHelperLines ↔ bool
-
Flag indicating if helper lines should be displayed.
getter/setter pair
- showHorizontalHelperLine ↔ bool
-
Flag indicating if horizontal helper lines should be displayed.
getter/setter pair
- showRotationHelperLine ↔ bool
-
Flag indicating if rotation helper lines should be displayed.
getter/setter pair
- showVerticalHelperLine ↔ bool
-
Flag indicating if vertical helper lines should be displayed.
getter/setter pair
- snapLastRotation ↔ double
-
Last recorded rotation angle during snapping.
getter/setter pair
- snapStartPosX ↔ double
-
X-coordinate where snapping started.
getter/setter pair
- snapStartPosY ↔ double
-
Y-coordinate where snapping started.
getter/setter pair
- snapStartRotation ↔ double
-
Initial rotation angle when snapping started.
getter/setter pair
Methods
-
calculateInteractiveButtonScaleRotate(
{required double editorScaleFactor, required Offset editorScaleOffset, required ProImageEditorConfigs configs, required ScaleUpdateDetails details, required Layer activeLayer, required Size editorSize, required bool configEnabledHitVibration, required ThemeLayerInteraction layerTheme}) → dynamic - Calculates scaling and rotation based on user interactions.
-
calculateMovement(
{required double editorScaleFactor, required BuildContext context, required ScaleUpdateDetails detail, required Layer activeLayer, required bool configEnabledHitVibration, required GlobalKey< State< removeAreaKey, required dynamic onHoveredRemoveChanged(bool)}) → dynamicStatefulWidget> > - Calculates movement of a layer based on user interactions, considering various conditions such as hit areas and screen boundaries.
-
calculateScaleRotate(
{required double editorScaleFactor, required ProImageEditorConfigs configs, required ScaleUpdateDetails detail, required Layer activeLayer, required Size editorSize, required EdgeInsets screenPaddingHelper, required bool configEnabledHitVibration}) → dynamic - Calculates scaling and rotation of a layer based on user interactions.
-
checkRotationLine(
{required Layer activeLayer, required Size editorSize, required bool configEnabledHitVibration}) → dynamic - Checks the rotation line based on user interactions, adjusting rotation accordingly.
-
flipLayer(
{required Layer layer, required bool flipX, required bool flipY, required bool isHalfPi, required double imageWidth, required double imageHeight}) → void - Flip a layer horizontally or vertically.
-
layersAreSelectable(
ProImageEditorConfigs configs) → bool - Determines if layers are selectable based on the configuration and device type.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onScaleEnd(
) → dynamic - Handles cleanup and resets various flags and states after scaling interaction ends.
-
rotateLayer(
{required Layer layer, required bool beforeIsFlipX, required double newImgW, required double newImgH, required double rotationScale, required double rotationRadian, required double rotationAngle}) → void - Rotate a layer.
-
toString(
) → String -
A string representation of this object.
inherited
-
zoomedLayer(
{required Layer layer, required double scale, required double scaleX, required double oldFullH, required double oldFullW, required double pixelRatio, required Rect cropRect, required bool isHalfPi}) → bool - Handles zooming of a layer.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited