Skip to content

need onModify event on ImageEditor #921

@bronze1man

Description

@bronze1man

Version

3.15.3

Development Environment

mac os 14.2.1 chrome 125.0.6422.113

Current Behavior

It is very difficult to fire onModify event.
Direct call instance.toDataURL() in undoStackChanged will cause the Draw i just paint disappear. Wait 100ms seems good:

Current workaround(vm.onSave is onModify event handler) :

        instance.on('undoStackChanged',(num)=>{
            if (vm.hasLoadSuccess == false && num>0 && instance?._invoker?._undoStack?.[0]?.name!=null && instance?._invoker?._undoStack?.[0]?.name!="loadImage"){
                vm.hasLoadSuccess = true
            }
            if (vm.hasLoadSuccess){
                   setTimeout(()=>{
                      const url = instance.toDataURL()
                      vm.onSave(url)
                   },100)
            }
        })
        instance.on('redoStackChanged',(event)=>{
            if (vm.hasLoadSuccess){
                   setTimeout(()=>{
                      const url = instance.toDataURL()
                      vm.onSave(url)
                   },100)
            }
        })

Expected Behavior

instance.on('modify',(event)=>{
         const url = instance.toDataURL()
         vm.onSave(url)
}

The modify event should not include loadImage, it should fire when I can call toDataURL.

Metadata

Metadata

Assignees

No one assigned

    Labels

    EnhancementEnhance performance or improve usability of original features.Need DiscussionNeed discussion or investigation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions