Open bronze1man opened 1 month ago
3.15.3
mac os 14.2.1 chrome 125.0.6422.113
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) } })
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.
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) :
Expected Behavior
The modify event should not include loadImage, it should fire when I can call toDataURL.