Mousewheel on an object

by 20yco

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

(function() {
  var canvas = this.__canvas = new fabric.Canvas('c');
  fabric.Object.prototype.transparentCorners = false;
    
   var text = 'Some text';        
    var textSample = new fabric.Text(text, {fill: '#666'});

textSample.clipTo = function (ctx) {
    ctx.rect(-textSample.width / 2, -textSample.height / 2, textSample.width/2, textSample.height/2 );
}

canvas.add(textSample);
    canvas.renderAll();
})();