Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

need onModify event on ImageEditor #921

Open
bronze1man opened this issue May 31, 2024 · 0 comments
Open

need onModify event on ImageEditor #921

bronze1man opened this issue May 31, 2024 · 0 comments
Labels
Enhancement Enhance performance or improve usability of original features. Need Discussion Need discussion or investigation

Comments

@bronze1man
Copy link

bronze1man commented May 31, 2024

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.

@bronze1man bronze1man added Enhancement Enhance performance or improve usability of original features. Need Discussion Need discussion or investigation labels May 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Enhance performance or improve usability of original features. Need Discussion Need discussion or investigation
Projects
None yet
Development

No branches or pull requests

1 participant