Reputation: 39
I want to check the image quality of the selected image on canvas.
My following code:
var canvas = $(".canvas-container").children('canvas').get(0);
//console.log(canvas.getActiveObject().get('type'));
console.log(canvas);
The getActiveObject() log gives an error: undefined is not a function.
The other log returns:
<canvas class="lower-canvas" width="850" height="230" style="position: absolute; width: 850px; height: 230px; left: 0px; top: 0px; -webkit-user-select: none;"></canvas>
The canvas is created in another js file:
//create fabric stage
var canvas = $productStage.children('canvas').get(0);
stage = new fabric.Canvas(canvas, {
selection: false,
hoverCursor: 'pointer',
rotationCursor: 'default',
controlsAboveOverlay: true,
centeredScaling: true
});
What must I change so I can use so I can use canvas.getActiveObject()?
See http://www.panel-it.eu/shop/straatnaambord-3/# for reference.
Thanks in advance.
Upvotes: 2
Views: 18143
Reputation: 495
getActiveObject()
is a method of a fabric.Canvas object.
With the above code, you would use stage.getActiveObject()
instead of canvas.getActiveObject()
Upvotes: 4