Always bring modified item to front in canvas
This commit is contained in:
parent
e8a2d1f2c9
commit
93310de194
3 changed files with 6 additions and 5 deletions
|
@ -531,10 +531,6 @@ export const MediaEditor = ({
|
|||
return;
|
||||
}
|
||||
|
||||
if (editMode !== EditMode.Text) {
|
||||
return;
|
||||
}
|
||||
|
||||
const obj = fabricCanvas.getActiveObject();
|
||||
|
||||
if (!obj || !(obj instanceof MediaEditorFabricIText)) {
|
||||
|
@ -544,7 +540,7 @@ export const MediaEditor = ({
|
|||
obj.exitEditing();
|
||||
obj.set(getTextStyleAttributes(textStyle, sliderValue));
|
||||
fabricCanvas.requestRenderAll();
|
||||
}, [editMode, fabricCanvas, sliderValue, textStyle]);
|
||||
}, [fabricCanvas, sliderValue, textStyle]);
|
||||
|
||||
// Create the CroppingRect
|
||||
useEffect(() => {
|
||||
|
@ -601,6 +597,7 @@ export const MediaEditor = ({
|
|||
setCanCrop(false);
|
||||
}, [editMode, fabricCanvas, imageState.height, imageState.width, zoom]);
|
||||
|
||||
// Create an IText node when edit mode changes to Text
|
||||
useEffect(() => {
|
||||
if (!fabricCanvas) {
|
||||
return;
|
||||
|
|
|
@ -15,6 +15,8 @@ export class MediaEditorFabricIText extends fabric.IText {
|
|||
textAlign: 'center',
|
||||
...options,
|
||||
});
|
||||
|
||||
this.on('modified', () => this.canvas?.bringToFront(this));
|
||||
}
|
||||
|
||||
static override fromObject(
|
||||
|
|
|
@ -19,6 +19,8 @@ export class MediaEditorFabricSticker extends fabric.Image {
|
|||
}
|
||||
|
||||
super(normalizedElement, options);
|
||||
|
||||
this.on('modified', () => this.canvas?.bringToFront(this));
|
||||
}
|
||||
|
||||
static fromObject(
|
||||
|
|
Loading…
Add table
Reference in a new issue