Mousewheel on an object
by tomfree
HTML
<script src="https://rawgithub.com/kangax/fabric.js/master/dist/fabric.js"></script>
<canvas id="c" width="600" height="600"></canvas>
CSS
canvas {
border: 1px solid #999;
}
JavaScript
/**
* fabric.js template for bug reports
*
* Please update the name of the jsfiddle (see Fiddle Options).
* This templates uses latest dev verison of fabric.js (https://rawgithub.com/kangax/fabric.js/master/dist/all.js).
*/
// initialize fabric canvas and assign to global windows object for debug
var canvas = window._canvas = new fabric.Canvas('c');
const newImg = new Image();
newImg.onload = (i) => {
console.log("loaded");
var fImg= new fabric.Image(newImg);
canvas.add(fImg);
canvas.renderAll();
}
newImg.src = "https://upload.wikimedia.org/wikipedia/commons/3/3f/Placeholder_view_vector.svg";
/*
fabric.Image.fromURL('http://fabricjs.com/assets/pug_small.jpg', function(img){
canvas.add(img.scale(0.4).set({ left: 450, top: 200, angle: 20 }));
});*/