I want to let all fabric canvas objects could be detected on mouse move, but cannot be click or select.
if (isHoverMode == true) {
canvas.selection = false
canvas.skipTargetFind = true // <-this cause object could be selectable!
canvas.on('mouse:over', function(e) {
// do something on e.target ...
});
}
It turns out that canvas.skipTargetFind
must set to true in order to have mouse:over
event to work. But then the objects could also be selected.
How could I prevent object to be selectable?
The object property you're looking for is selectable
.
Use it like this for a single object:
obj.set('selectable', false);
Or like this for all objects:
fabric.Object.prototype.selectable = false;
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.