mirror of
https://github.com/Hopiu/fabric.js.git
synced 2026-05-23 20:55:47 +00:00
JSHint, restoring .gitignore
This commit is contained in:
parent
116a630def
commit
009c5389bf
7 changed files with 29 additions and 31 deletions
5
.gitignore
vendored
Normal file
5
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
.DS_Store
|
||||
/node_modules/
|
||||
/npm-debug.log
|
||||
before_commit
|
||||
/coverage/
|
||||
|
|
@ -187,7 +187,7 @@ fabric.SprayBrush = fabric.util.createClass( fabric.BaseBrush, /** @lends fabric
|
|||
}
|
||||
|
||||
var point = new fabric.Point(x, y);
|
||||
point.width = width
|
||||
point.width = width;
|
||||
|
||||
if (this.randomOpacity) {
|
||||
point.opacity = fabric.util.getRandomInt(0, 100) / 100;
|
||||
|
|
|
|||
|
|
@ -346,8 +346,8 @@
|
|||
*/
|
||||
_onMouseMoveInDrawingMode: function(e) {
|
||||
if (this._isCurrentlyDrawing) {
|
||||
var ivt = fabric.util.invertTransform(this.viewportTransform);
|
||||
pointer = fabric.util.transformPoint(this.getPointer(e, true), ivt);
|
||||
var ivt = fabric.util.invertTransform(this.viewportTransform),
|
||||
pointer = fabric.util.transformPoint(this.getPointer(e, true), ivt);
|
||||
this.freeDrawingBrush.onMouseMove(pointer);
|
||||
}
|
||||
this.upperCanvasEl.style.cursor = this.freeDrawingCursor;
|
||||
|
|
@ -548,11 +548,7 @@
|
|||
* @param {Event} e Event fired on mousemove
|
||||
*/
|
||||
_transformObject: function(e) {
|
||||
var pointer = fabric.util.transformPoint(
|
||||
fabric.util.getPointer(e, this.upperCanvasEl),
|
||||
fabric.util.invertTransform(this.viewportTransform)
|
||||
),
|
||||
pointer = this.getPointer(e),
|
||||
var pointer = this.getPointer(e),
|
||||
transform = this._currentTransform;
|
||||
|
||||
transform.reset = false,
|
||||
|
|
|
|||
|
|
@ -304,13 +304,12 @@
|
|||
setCoords: function() {
|
||||
|
||||
var strokeWidth = this.strokeWidth > 1 ? this.strokeWidth : 0,
|
||||
padding = this.padding,
|
||||
theta = degreesToRadians(this.angle),
|
||||
vpt = this.getViewportTransform();
|
||||
|
||||
var f = function (p) {
|
||||
return fabric.util.transformPoint(p, vpt);
|
||||
}
|
||||
};
|
||||
|
||||
this.currentWidth = (this.width + strokeWidth) * this.scaleX;
|
||||
this.currentHeight = (this.height + strokeWidth) * this.scaleY;
|
||||
|
|
@ -332,20 +331,20 @@
|
|||
sinTh = Math.sin(theta),
|
||||
cosTh = Math.cos(theta),
|
||||
coords = this.getCenterPoint(),
|
||||
wh = new fabric.Point(this.currentWidth, this.currentHeight);
|
||||
var _tl = new fabric.Point(coords.x - offsetX, coords.y - offsetY);
|
||||
var _tr = new fabric.Point(_tl.x + (wh.x * cosTh), _tl.y + (wh.x * sinTh));
|
||||
var _bl = new fabric.Point(_tl.x - (wh.y * sinTh), _tl.y + (wh.y * cosTh));
|
||||
var _mt = new fabric.Point(_tl.x + (wh.x/2 * cosTh), _tl.y + (wh.x/2 * sinTh));
|
||||
var tl = f(_tl);
|
||||
var tr = f(_tr);
|
||||
var br = f(new fabric.Point(_tr.x - (wh.y * sinTh), _tr.y + (wh.y * cosTh)));
|
||||
var bl = f(_bl);
|
||||
var ml = f(new fabric.Point(_tl.x - (wh.y/2 * sinTh), _tl.y + (wh.y/2 * cosTh)));
|
||||
var mt = f(_mt);
|
||||
var mr = f(new fabric.Point(_tr.x - (wh.y/2 * sinTh), _tr.y + (wh.y/2 * cosTh)));
|
||||
var mb = f(new fabric.Point(_bl.x + (wh.x/2 * cosTh), _bl.y + (wh.x/2 * sinTh)));
|
||||
var mtr = f(new fabric.Point(_mt.x, _mt.y));
|
||||
wh = new fabric.Point(this.currentWidth, this.currentHeight),
|
||||
_tl = new fabric.Point(coords.x - offsetX, coords.y - offsetY),
|
||||
_tr = new fabric.Point(_tl.x + (wh.x * cosTh), _tl.y + (wh.x * sinTh)),
|
||||
_bl = new fabric.Point(_tl.x - (wh.y * sinTh), _tl.y + (wh.y * cosTh)),
|
||||
_mt = new fabric.Point(_tl.x + (wh.x/2 * cosTh), _tl.y + (wh.x/2 * sinTh)),
|
||||
tl = f(_tl),
|
||||
tr = f(_tr),
|
||||
br = f(new fabric.Point(_tr.x - (wh.y * sinTh), _tr.y + (wh.y * cosTh))),
|
||||
bl = f(_bl),
|
||||
ml = f(new fabric.Point(_tl.x - (wh.y/2 * sinTh), _tl.y + (wh.y/2 * cosTh))),
|
||||
mt = f(_mt),
|
||||
mr = f(new fabric.Point(_tr.x - (wh.y/2 * sinTh), _tr.y + (wh.y/2 * cosTh))),
|
||||
mb = f(new fabric.Point(_bl.x + (wh.x/2 * cosTh), _bl.y + (wh.x/2 * sinTh))),
|
||||
mtr = f(new fabric.Point(_mt.x, _mt.y));
|
||||
|
||||
// padding
|
||||
var padX = Math.cos(_angle + theta) * this.padding * Math.sqrt(2),
|
||||
|
|
|
|||
|
|
@ -333,8 +333,6 @@
|
|||
height = wh.y,
|
||||
left = -(width / 2),
|
||||
top = -(height / 2),
|
||||
_left,
|
||||
_top,
|
||||
padding = this.padding,
|
||||
scaleOffset = size2,
|
||||
scaleOffsetSize = size2 - size,
|
||||
|
|
|
|||
|
|
@ -538,7 +538,7 @@
|
|||
* @return {Number}
|
||||
*/
|
||||
getZoom: function () {
|
||||
return sqrt(this.viewportTransform[0] * this.viewportTransform[3]);
|
||||
return Math.sqrt(this.viewportTransform[0] * this.viewportTransform[3]);
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
@ -553,7 +553,7 @@
|
|||
x = this.viewportTransform[4],
|
||||
y = this.viewportTransform[5];
|
||||
|
||||
return new fabric.Point(this.getWidth()/2 + x, this.getHeight()/2 + y);
|
||||
return new fabric.Point(wh.x + x, wh.y + y);
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
@ -563,7 +563,7 @@
|
|||
* @chainable true
|
||||
*/
|
||||
setViewportTransform: function (vpt) {
|
||||
this.viewportTransform = vpt
|
||||
this.viewportTransform = vpt;
|
||||
this.renderAll();
|
||||
for (var i = 0, len = this._objects.length; i < len; i++) {
|
||||
this._objects[i].setCoords();
|
||||
|
|
@ -676,7 +676,7 @@
|
|||
obj._objects[i].canvas = this;
|
||||
this._onObjectAdded(obj._objects[i]);
|
||||
}
|
||||
obj._updateObjectsCoords()
|
||||
obj._updateObjectsCoords();
|
||||
}
|
||||
obj.setCoords();
|
||||
this.fire('object:added', { target: obj });
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@
|
|||
var o = fabric.util.transformPoint({x: t[4], y: t[5]}, r);
|
||||
r[4] = -o.x;
|
||||
r[5] = -o.y;
|
||||
return r
|
||||
return r;
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in a new issue