Can outsideCaptureAreaLayerOpacity be changed while isLayerBeingTransformed is true? #723
-
|
Hi 👋 In my app I set outsideCaptureAreaLayerOpacity to 1.0 to fully cover the area outside the image frame. However, when a user drags a layer to delete it (the trash target can be outside the image area), the layer may become invisible as soon as it moves outside the frame — especially when the image itself is small. What I want: Keep outsideCaptureAreaLayerOpacity = 1.0 normally. While isLayerBeingTransformed == true (dragging / transforming a layer), temporarily apply a lower opacity (or 0.0) so the layer remains visible even outside the image frame. Restore the opacity after the interaction ends. Is there a supported way to update outsideCaptureAreaLayerOpacity dynamically based on isLayerBeingTransformed? Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
|
The best way to do that is to use callbacks to check when the user moves a layer and then update the config values accordingly. For example: double _outsideOpacity = 1;
@override
Widget build(BuildContext context) {
return ProImageEditor.asset(
kImageEditorExampleAssetPath,
key: editorKey,
callbacks: ProImageEditorCallbacks(
mainEditorCallbacks: MainEditorCallbacks(
onScaleStart: (value) {
if (editorKey.currentState!.isLayerBeingTransformed) {
_outsideOpacity = 0;
setState(() {});
}
},
onScaleEnd: (value) {
_outsideOpacity = 1.0;
setState(() {});
},
),
),
configs: ProImageEditorConfigs(
mainEditor: MainEditorConfigs(
style: MainEditorStyle(
outsideCaptureAreaLayerOpacity: _outsideOpacity,
),
),
),
);
}
|
Beta Was this translation helpful? Give feedback.
The best way to do that is to use callbacks to check when the user moves a layer and then update the config values accordingly. For example: