mirror of
https://github.com/Hopiu/fabric.js.git
synced 2026-04-06 15:30:59 +00:00
Merge pull request #2068 from asturur/fix-jscs
attemp to fix jscs crash
This commit is contained in:
commit
e43ebdfea7
9 changed files with 78 additions and 77 deletions
|
|
@ -123,10 +123,10 @@ fabric.SprayBrush = fabric.util.createClass( fabric.BaseBrush, /** @lends fabric
|
|||
this.canvas.renderAll();
|
||||
},
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @param {Array} rects
|
||||
*/
|
||||
/**
|
||||
* @private
|
||||
* @param {Array} rects
|
||||
*/
|
||||
_getOptimizedRects: function(rects) {
|
||||
|
||||
// avoid creating duplicate rects at the same coordinates
|
||||
|
|
|
|||
|
|
@ -808,7 +808,7 @@
|
|||
var target,
|
||||
pointer = this.getPointer(e, true),
|
||||
i = this._objects.length;
|
||||
// Do not check for currently grouped objects, since we check the parent group itself.
|
||||
// Do not check for currently grouped objects, since we check the parent group itself.
|
||||
while (i--) {
|
||||
if (!this._objects[i].group && this._checkTarget(e, this._objects[i], pointer)){
|
||||
this.relatedTarget = this._objects[i];
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@
|
|||
data = imageData.data,
|
||||
tr, tg, tb,
|
||||
r, g, b,
|
||||
_r, _g, _b,
|
||||
source,
|
||||
isImage = false;
|
||||
|
||||
|
|
@ -100,9 +101,9 @@
|
|||
data[i + 2] = Math.abs(b - tb);
|
||||
break;
|
||||
case 'subtract':
|
||||
var _r = r - tr,
|
||||
_g = g - tg,
|
||||
_b = b - tb;
|
||||
_r = r - tr;
|
||||
_g = g - tg;
|
||||
_b = b - tb;
|
||||
|
||||
data[i] = (_r < 0) ? 0 : _r;
|
||||
data[i + 1] = (_g < 0) ? 0 : _g;
|
||||
|
|
|
|||
|
|
@ -638,7 +638,7 @@
|
|||
if (transform.action === 'scale' || transform.action === 'scaleX' || transform.action === 'scaleY') {
|
||||
var centerTransform = this._shouldCenterTransform(e, transform.target);
|
||||
|
||||
// Switch from a normal resize to center-based
|
||||
// Switch from a normal resize to center-based
|
||||
if ((centerTransform && (transform.originX !== 'center' || transform.originY !== 'center')) ||
|
||||
// Switch from center-based resize to normal one
|
||||
(!centerTransform && transform.originX === 'center' && transform.originY === 'center')
|
||||
|
|
|
|||
|
|
@ -558,8 +558,8 @@
|
|||
this.insertStyleObjects(_chars, isEndOfLine, useCopiedStyle);
|
||||
}
|
||||
// else if (this.selectionEnd - this.selectionStart > 1) {
|
||||
// TODO: replace styles properly
|
||||
// console.log('replacing MORE than 1 char');
|
||||
// TODO: replace styles properly
|
||||
// console.log('replacing MORE than 1 char');
|
||||
// }
|
||||
this.setSelectionStart(this.selectionStart + _chars.length);
|
||||
this.setSelectionEnd(this.selectionStart);
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
var degreesToRadians = fabric.util.degreesToRadians,
|
||||
//jscs:disable requireCamelCaseOrUpperCaseIdentifiers
|
||||
isVML = function() { return typeof G_vmlCanvasManager !== 'undefined'; };
|
||||
//jscs:enable requireCamelCaseOrUpperCaseIdentifiers
|
||||
//jscs:enable requireCamelCaseOrUpperCaseIdentifiers
|
||||
|
||||
fabric.util.object.extend(fabric.Object.prototype, /** @lends fabric.Object.prototype */ {
|
||||
|
||||
|
|
|
|||
|
|
@ -555,10 +555,10 @@
|
|||
};
|
||||
})();
|
||||
|
||||
/**
|
||||
* Used for caching SVG documents (loaded via `fabric.Canvas#loadSVGFromURL`)
|
||||
* @namespace
|
||||
*/
|
||||
/**
|
||||
* Used for caching SVG documents (loaded via `fabric.Canvas#loadSVGFromURL`)
|
||||
* @namespace
|
||||
*/
|
||||
var svgCache = {
|
||||
|
||||
/**
|
||||
|
|
@ -821,7 +821,7 @@
|
|||
|
||||
// odd number of points is an error
|
||||
// if (parsedPoints.length % 2 !== 0) {
|
||||
// return null;
|
||||
// return null;
|
||||
// }
|
||||
|
||||
return parsedPoints;
|
||||
|
|
|
|||
|
|
@ -2,52 +2,52 @@
|
|||
|
||||
var clone = fabric.util.object.clone;
|
||||
|
||||
/**
|
||||
* IText class (introduced in <b>v1.4</b>) Events are also fired with "text:"
|
||||
* prefix when observing canvas.
|
||||
* @class fabric.IText
|
||||
* @extends fabric.Text
|
||||
* @mixes fabric.Observable
|
||||
*
|
||||
* @fires changed
|
||||
* @fires selection:changed
|
||||
* @fires editing:entered
|
||||
* @fires editing:exited
|
||||
*
|
||||
* @return {fabric.IText} thisArg
|
||||
* @see {@link fabric.IText#initialize} for constructor definition
|
||||
*
|
||||
* <p>Supported key combinations:</p>
|
||||
* <pre>
|
||||
* Move cursor: left, right, up, down
|
||||
* Select character: shift + left, shift + right
|
||||
* Select text vertically: shift + up, shift + down
|
||||
* Move cursor by word: alt + left, alt + right
|
||||
* Select words: shift + alt + left, shift + alt + right
|
||||
* Move cursor to line start/end: cmd + left, cmd + right or home, end
|
||||
* Select till start/end of line: cmd + shift + left, cmd + shift + right or shift + home, shift + end
|
||||
* Jump to start/end of text: cmd + up, cmd + down
|
||||
* Select till start/end of text: cmd + shift + up, cmd + shift + down or shift + pgUp, shift + pgDown
|
||||
* Delete character: backspace
|
||||
* Delete word: alt + backspace
|
||||
* Delete line: cmd + backspace
|
||||
* Forward delete: delete
|
||||
* Copy text: ctrl/cmd + c
|
||||
* Paste text: ctrl/cmd + v
|
||||
* Cut text: ctrl/cmd + x
|
||||
* Select entire text: ctrl/cmd + a
|
||||
* Quit editing tab or esc
|
||||
* </pre>
|
||||
*
|
||||
* <p>Supported mouse/touch combination</p>
|
||||
* <pre>
|
||||
* Position cursor: click/touch
|
||||
* Create selection: click/touch & drag
|
||||
* Create selection: click & shift + click
|
||||
* Select word: double click
|
||||
* Select line: triple click
|
||||
* </pre>
|
||||
*/
|
||||
/**
|
||||
* IText class (introduced in <b>v1.4</b>) Events are also fired with "text:"
|
||||
* prefix when observing canvas.
|
||||
* @class fabric.IText
|
||||
* @extends fabric.Text
|
||||
* @mixes fabric.Observable
|
||||
*
|
||||
* @fires changed
|
||||
* @fires selection:changed
|
||||
* @fires editing:entered
|
||||
* @fires editing:exited
|
||||
*
|
||||
* @return {fabric.IText} thisArg
|
||||
* @see {@link fabric.IText#initialize} for constructor definition
|
||||
*
|
||||
* <p>Supported key combinations:</p>
|
||||
* <pre>
|
||||
* Move cursor: left, right, up, down
|
||||
* Select character: shift + left, shift + right
|
||||
* Select text vertically: shift + up, shift + down
|
||||
* Move cursor by word: alt + left, alt + right
|
||||
* Select words: shift + alt + left, shift + alt + right
|
||||
* Move cursor to line start/end: cmd + left, cmd + right or home, end
|
||||
* Select till start/end of line: cmd + shift + left, cmd + shift + right or shift + home, shift + end
|
||||
* Jump to start/end of text: cmd + up, cmd + down
|
||||
* Select till start/end of text: cmd + shift + up, cmd + shift + down or shift + pgUp, shift + pgDown
|
||||
* Delete character: backspace
|
||||
* Delete word: alt + backspace
|
||||
* Delete line: cmd + backspace
|
||||
* Forward delete: delete
|
||||
* Copy text: ctrl/cmd + c
|
||||
* Paste text: ctrl/cmd + v
|
||||
* Cut text: ctrl/cmd + x
|
||||
* Select entire text: ctrl/cmd + a
|
||||
* Quit editing tab or esc
|
||||
* </pre>
|
||||
*
|
||||
* <p>Supported mouse/touch combination</p>
|
||||
* <pre>
|
||||
* Position cursor: click/touch
|
||||
* Create selection: click/touch & drag
|
||||
* Create selection: click & shift + click
|
||||
* Select word: double click
|
||||
* Select line: triple click
|
||||
* </pre>
|
||||
*/
|
||||
fabric.IText = fabric.util.createClass(fabric.Text, fabric.Observable, /** @lends fabric.IText.prototype */ {
|
||||
|
||||
/**
|
||||
|
|
@ -405,8 +405,8 @@
|
|||
*/
|
||||
_getCursorBoundaries: function(chars, typeOfBoundaries) {
|
||||
|
||||
// left/top are left/top of entire text box
|
||||
// leftOffset/topOffset are offset from that left/top point of a text box
|
||||
// left/top are left/top of entire text box
|
||||
// leftOffset/topOffset are offset from that left/top point of a text box
|
||||
|
||||
var left = Math.round(this._getLeftOffset()),
|
||||
top = this._getTopOffset(),
|
||||
|
|
|
|||
|
|
@ -1,17 +1,17 @@
|
|||
(function() {
|
||||
|
||||
/**
|
||||
* Changes value from one to another within certain period of time, invoking callbacks as value is being changed.
|
||||
* @memberOf fabric.util
|
||||
* @param {Object} [options] Animation options
|
||||
* @param {Function} [options.onChange] Callback; invoked on every value change
|
||||
* @param {Function} [options.onComplete] Callback; invoked when value change is completed
|
||||
* @param {Number} [options.startValue=0] Starting value
|
||||
* @param {Number} [options.endValue=100] Ending value
|
||||
* @param {Number} [options.byValue=100] Value to modify the property by
|
||||
* @param {Function} [options.easing] Easing function
|
||||
* @param {Number} [options.duration=500] Duration of change (in ms)
|
||||
*/
|
||||
/**
|
||||
* Changes value from one to another within certain period of time, invoking callbacks as value is being changed.
|
||||
* @memberOf fabric.util
|
||||
* @param {Object} [options] Animation options
|
||||
* @param {Function} [options.onChange] Callback; invoked on every value change
|
||||
* @param {Function} [options.onComplete] Callback; invoked when value change is completed
|
||||
* @param {Number} [options.startValue=0] Starting value
|
||||
* @param {Number} [options.endValue=100] Ending value
|
||||
* @param {Number} [options.byValue=100] Value to modify the property by
|
||||
* @param {Function} [options.easing] Easing function
|
||||
* @param {Number} [options.duration=500] Duration of change (in ms)
|
||||
*/
|
||||
function animate(options) {
|
||||
|
||||
requestAnimFrame(function(timestamp) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue