4.0.0-beta.12
https://jsfiddle.net/ckitisak/kzd6Lufa/
Let say I have create a circle object and remove all default controls by replacing them with 2 custom controls call "save" and "cancel". When I clicked on the cancel control sometimes the error Uncaught TypeError: transform.actionHandler is not a function appears on console log before arrives to mouseUpHandler callback of the custom control as you can see in the screenshot below so how to prevent the error like this?
for more information please see in SO here
you should add the action handler as a noop.
We could embed it too, but yes, controls are supposed to have an action as of now.
Maybe we can add noop in the prototype and call it fixed?
@asturur Thank you for a quick reply. I'm not sure about what you have mentioned "noop". Would you please explain a little bit more or guided me where to change or update?
noop = no operation. Is an empty function. () => {} or function() {}
Is also available from lodash with this name.
After I added noop actionHandler like below. the error seem to be gone now. Thank you.
new fabric.Control({
x: 1,
y: -1.5,
offsetY: 16,
cursorStyle: 'pointer',
mouseUpHandler: cancel,
actionHandler: ()=>{},
render: renderIcon,
cornerSize: 24
});
We can fix the control prototype so that this is not necessary.
@CKitisak i verified and in the version rc1, this empty action handler already exist.
So we already fixed, but you were using beta12 instead of the newer one.
@asturur thank you I will switch to the rc1 version.