Reputation: 2553
Using Fabric.js, is it possible to trigger the "mousedown", "move", and "mouseup" events from outside the canvas, e.g. with jQuery ui slider control?
I can't see any way to get a reference to each object so as to trigger events on it from outside canvas.
Upvotes: 0
Views: 3817
Reputation: 2553
I just didn't see this example for how to access the objects:
This does what I needed.
Upvotes: 1
Reputation: 3517
Why you want to trigger events from outside? With the following function calls you can get access to objects:
var activeObject = canvas.getActiveObject();
var activeGroup = canvas.getActiveGroup();
var object1 = canvas.item(0); // item(1) ...
canvas.forEachObject(function(o) {
//iterate over all existing objects
});
var objects = canvas.getObjects(); // returns array of all objects
Upvotes: 2