admin管理员组文章数量:1355026
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 for reference.
Thanks in advance.
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.
Share Improve this question asked Nov 19, 2014 at 15:25 Robin RiegmanRobin Riegman 391 gold badge1 silver badge4 bronze badges1 Answer
Reset to default 4getActiveObject()
is a method of a fabric.Canvas object.
With the above code, you would use stage.getActiveObject()
instead of canvas.getActiveObject()
本文标签: javascriptCannot use getActiveObject() in FabricjsStack Overflow
版权声明:本文标题:javascript - Cannot use getActiveObject() in Fabric.js - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744037661a2580076.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论