简体   繁体   中英

Fabric JS; How to make an object unmovable until the object is "fully" clicked (mouse down and mouse up)

I am wondering if it is possible to make an object unmovable until it is "fully" clicked. At the moment the object is movable as soon as it is selected, which is not great because it can lead to accidental movements. Is it possible to disable all movement of an object until it is fully clicked? ie the user clicks the objects and releases the mouse so both onMouseDown and onMouseUp is triggered.

FabricJS vs 4.4.0 introduced a new object property called activeOn . By default, the value is 'down', meaning that objects are made active on mouse down/touch start. If you change the value to 'up', the object will only be made active after mouse up/touch end. http://fabricjs.com/changelog

fabric.Object.prototype.activeOn = "up";

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM