javascript - How can i change the rotation icon in fabricjs -


please guide me modify fabricjs add custom icon rotation.

i of answers not working fine.

please let me know code change particular rotation icon only.

for fabricjs above 1.6.6 changing function object prototype drawcontrols, small changes on hasrotation condition, result can seen jsfidle

fabric.object.prototype.drawcontrols = function (ctx) {    if (!this.hascontrols) {     return this;   }    var wh = this._calculatecurrentdimensions(),   width = wh.x,   height = wh.y,   scaleoffset = this.cornersize,   left = -(width + scaleoffset) / 2,   top = -(height + scaleoffset) / 2,   methodname = this.transparentcorners ? 'stroke' : 'fill';    ctx.save();   ctx.strokestyle = ctx.fillstyle = this.cornercolor;   if (!this.transparentcorners) {     ctx.strokestyle = this.cornerstrokecolor;   }  this._setlinedash(ctx, this.cornerdasharray, null);    // top-left  this._drawcontrol('tl', ctx, methodname,left,top);   // top-right this._drawcontrol('tr', ctx, methodname, left + width,top);  // bottom-left this._drawcontrol('bl', ctx, methodname,left, top + height);  // bottom-right this._drawcontrol('br', ctx, methodname,left + width,top + height);  if (!this.get('lockuniscaling')) {  // middle-top this._drawcontrol('mt', ctx, methodname,   left + width / 2,   top);  // middle-bottom this._drawcontrol('mb', ctx, methodname,   left + width / 2,   top + height);  // middle-right this._drawcontrol('mr', ctx, methodname,   left + width,   top + height / 2);  // middle-left this._drawcontrol('ml', ctx, methodname,   left,   top + height / 2); }  // middle-top-rotate if (this.hasrotatingpoint) {   var rotate = new image(), rotateleft, rotatetop;   rotate.src = 'http://localhost:8000/images/toolbar/close.svg';   rotateleft = left + width / 2;   rotatetop = top - this.rotatingpointoffset;   ctx.drawimage(rotate, rotateleft, rotatetop, 10, 15); }  ctx.restore();  return this;  } 

Comments

Popular posts from this blog

jQuery Mobile app not scrolling in Firefox -

c++ - How to add Crypto++ library to Qt project -

php array slice every 2th rule -