mirror of
https://github.com/Hopiu/fabric.js.git
synced 2026-03-16 22:10:32 +00:00
fix space and linebreak
This commit is contained in:
parent
a5baf7ae39
commit
563ec42196
15 changed files with 59 additions and 46 deletions
2
build.js
2
build.js
|
|
@ -53,7 +53,7 @@ else if (minifier === 'closure') {
|
|||
mininfierCmd = 'java -jar ' + rootPath + '/lib/google_closure_compiler.jar --js fabric.js --js_output_file fabric.min.js' + sourceMapFlags;
|
||||
}
|
||||
else if (minifier === 'uglifyjs') {
|
||||
mininfierCmd = 'uglifyjs ' + amdUglifyFlags + ' --output fabric.min.js fabric.js' + sourceMapFlags;
|
||||
mininfierCmd = 'uglifyjs ' + amdUglifyFlags + ' --output fabric.min.js fabric.js' + sourceMapFlags;
|
||||
}
|
||||
|
||||
var buildSh = 'build-sh' in buildArgsAsObject;
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ fabric.BaseBrush = fabric.util.createClass(/** @lends fabric.BaseBrush.prototype
|
|||
* @type fabric.Shadow
|
||||
* @default
|
||||
*/
|
||||
shadow: null,
|
||||
shadow: null,
|
||||
|
||||
/**
|
||||
* Line endings style of a brush (one of "butt", "round", "square")
|
||||
|
|
@ -47,7 +47,7 @@ fabric.BaseBrush = fabric.util.createClass(/** @lends fabric.BaseBrush.prototype
|
|||
* @type Array
|
||||
* @default
|
||||
*/
|
||||
strokeDashArray: null,
|
||||
strokeDashArray: null,
|
||||
|
||||
/**
|
||||
* Sets shadow of an object
|
||||
|
|
|
|||
|
|
@ -20,10 +20,11 @@ fabric.CircleBrush = fabric.util.createClass(fabric.BaseBrush, /** @lends fabric
|
|||
this.canvas = canvas;
|
||||
this.points = [ ];
|
||||
},
|
||||
|
||||
/**
|
||||
* Invoked inside on mouse down and mouse move
|
||||
* @param {Object} pointer
|
||||
*/
|
||||
* Invoked inside on mouse down and mouse move
|
||||
* @param {Object} pointer
|
||||
*/
|
||||
drawDot: function(pointer) {
|
||||
var point = this.addPoint(pointer),
|
||||
ctx = this.canvas.contextTop,
|
||||
|
|
|
|||
|
|
@ -780,8 +780,8 @@
|
|||
},
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
* @private
|
||||
*/
|
||||
_checkTarget: function(e, obj, pointer) {
|
||||
if (obj &&
|
||||
obj.visible &&
|
||||
|
|
|
|||
|
|
@ -140,6 +140,7 @@
|
|||
_onShake: function(e, self) {
|
||||
this.__onShake && this.__onShake(e, self);
|
||||
},
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @param {Event} [e] Event object fired on Event.js shake
|
||||
|
|
@ -524,14 +525,14 @@
|
|||
},
|
||||
|
||||
/**
|
||||
* Method that defines the actions when mouse is hovering the canvas.
|
||||
* The currentTransform parameter will definde whether the user is rotating/scaling/translating
|
||||
* an image or neither of them (only hovering). A group selection is also possible and would cancel
|
||||
* all any other type of action.
|
||||
* In case of an image transformation only the top canvas will be rendered.
|
||||
* @private
|
||||
* @param {Event} e Event object fired on mousemove
|
||||
*/
|
||||
* Method that defines the actions when mouse is hovering the canvas.
|
||||
* The currentTransform parameter will definde whether the user is rotating/scaling/translating
|
||||
* an image or neither of them (only hovering). A group selection is also possible and would cancel
|
||||
* all any other type of action.
|
||||
* In case of an image transformation only the top canvas will be rendered.
|
||||
* @private
|
||||
* @param {Event} e Event object fired on mousemove
|
||||
*/
|
||||
__onMouseMove: function (e) {
|
||||
|
||||
var target, pointer;
|
||||
|
|
|
|||
|
|
@ -64,6 +64,7 @@
|
|||
this.renderAll();
|
||||
t.action = 'drag';
|
||||
},
|
||||
|
||||
/**
|
||||
* Method that defines actions when an Event.js drag is detected.
|
||||
*
|
||||
|
|
@ -75,6 +76,7 @@
|
|||
e: e, self: self
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Method that defines actions when an Event.js orientation event is detected.
|
||||
*
|
||||
|
|
@ -86,6 +88,7 @@
|
|||
e: e, self: self
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Method that defines actions when an Event.js shake event is detected.
|
||||
*
|
||||
|
|
@ -97,6 +100,7 @@
|
|||
e: e, self: self
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Method that defines actions when an Event.js longpress event is detected.
|
||||
*
|
||||
|
|
@ -108,6 +112,7 @@
|
|||
e: e, self: self
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Scales an object by a factor
|
||||
* @param {Number} s The scale factor to apply to the current scale level
|
||||
|
|
@ -141,6 +146,7 @@
|
|||
|
||||
target.setPositionByOrigin(constraintPosition, t.originX, t.originY);
|
||||
},
|
||||
|
||||
/**
|
||||
* Rotates object by an angle
|
||||
* @param {Number} curAngle The angle of rotation in degrees
|
||||
|
|
|
|||
|
|
@ -379,8 +379,8 @@
|
|||
},
|
||||
|
||||
/**
|
||||
* Initializes "mousemove" event handler
|
||||
*/
|
||||
* Initializes "mousemove" event handler
|
||||
*/
|
||||
initMouseMoveHandler: function() {
|
||||
var _this = this;
|
||||
this.canvas.on('mouse:move', function(options) {
|
||||
|
|
|
|||
|
|
@ -341,6 +341,7 @@
|
|||
}
|
||||
return selectors.length === 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
|
|
@ -574,9 +575,9 @@
|
|||
var svgCache = {
|
||||
|
||||
/**
|
||||
* @param {String} name
|
||||
* @param {Function} callback
|
||||
*/
|
||||
* @param {String} name
|
||||
* @param {Function} callback
|
||||
*/
|
||||
has: function (name, callback) {
|
||||
callback(false);
|
||||
},
|
||||
|
|
|
|||
|
|
@ -285,12 +285,13 @@
|
|||
* object.
|
||||
* @param {fabric.Object} object
|
||||
* @return {fabric.Object} transformedObject
|
||||
*/
|
||||
*/
|
||||
realizeTransform: function(object) {
|
||||
this._moveFlippedObject(object);
|
||||
this._setObjectPosition(object);
|
||||
return object;
|
||||
},
|
||||
|
||||
/**
|
||||
* Moves a flipped object to the position where it's displayed
|
||||
* @private
|
||||
|
|
|
|||
|
|
@ -362,6 +362,7 @@
|
|||
}
|
||||
return canvasEl;
|
||||
},
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @param {CanvasRenderingContext2D} ctx Context to render on
|
||||
|
|
@ -395,6 +396,7 @@
|
|||
|
||||
this._renderStroke(ctx);
|
||||
},
|
||||
|
||||
/**
|
||||
* @private, needed to check if image needs resize
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -303,9 +303,9 @@
|
|||
},
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @param {CanvasRenderingContext2D} ctx Context to render on
|
||||
*/
|
||||
* @private
|
||||
* @param {CanvasRenderingContext2D} ctx Context to render on
|
||||
*/
|
||||
_render: function(ctx) {
|
||||
this.callSuper('_render', ctx);
|
||||
this.ctx = ctx;
|
||||
|
|
@ -367,7 +367,7 @@
|
|||
* Returns complete style of char at the current cursor
|
||||
* @param {Number} lineIndex Line index
|
||||
* @param {Number} charIndex Char index
|
||||
* @return {Object} Character style
|
||||
* @return {Object} Character style
|
||||
*/
|
||||
getCurrentCharStyle: function(lineIndex, charIndex) {
|
||||
var style = this.styles[lineIndex] && this.styles[lineIndex][charIndex === 0 ? 0 : (charIndex - 1)];
|
||||
|
|
|
|||
|
|
@ -55,13 +55,14 @@
|
|||
function(callback) {
|
||||
fabric.window.setTimeout(callback, 1000 / 60);
|
||||
};
|
||||
|
||||
/**
|
||||
* requestAnimationFrame polyfill based on http://paulirish.com/2011/requestanimationframe-for-smart-animating/
|
||||
* In order to get a precise start time, `requestAnimFrame` should be called as an entry into the method
|
||||
* @memberOf fabric.util
|
||||
* @param {Function} callback Callback to invoke
|
||||
* @param {DOMElement} element optional Element to associate with animation
|
||||
*/
|
||||
* requestAnimationFrame polyfill based on http://paulirish.com/2011/requestanimationframe-for-smart-animating/
|
||||
* In order to get a precise start time, `requestAnimFrame` should be called as an entry into the method
|
||||
* @memberOf fabric.util
|
||||
* @param {Function} callback Callback to invoke
|
||||
* @param {DOMElement} element optional Element to associate with animation
|
||||
*/
|
||||
function requestAnimFrame() {
|
||||
return _requestAnimFrame.apply(fabric.window, arguments);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -96,8 +96,8 @@
|
|||
}
|
||||
|
||||
/*
|
||||
* Private
|
||||
*/
|
||||
* Private
|
||||
*/
|
||||
function calcVectorAngle(ux, uy, vx, vy) {
|
||||
var ta = Math.atan2(uy, ux),
|
||||
tb = Math.atan2(vy, vx);
|
||||
|
|
|
|||
|
|
@ -182,12 +182,12 @@
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns style attribute value of a given element
|
||||
* @memberOf fabric.util
|
||||
* @param {HTMLElement} element Element to get style attribute for
|
||||
* @param {String} attr Style attribute to get for element
|
||||
* @return {String} Style attribute value of the given element.
|
||||
*/
|
||||
* Returns style attribute value of a given element
|
||||
* @memberOf fabric.util
|
||||
* @param {HTMLElement} element Element to get style attribute for
|
||||
* @param {String} attr Style attribute to get for element
|
||||
* @return {String} Style attribute value of the given element.
|
||||
*/
|
||||
var getElementStyle;
|
||||
if (fabric.document.defaultView && fabric.document.defaultView.getComputedStyle) {
|
||||
getElementStyle = function(element, attr) {
|
||||
|
|
|
|||
|
|
@ -179,12 +179,12 @@
|
|||
},
|
||||
|
||||
/**
|
||||
* Returns klass "Class" object of given namespace
|
||||
* @memberOf fabric.util
|
||||
* @param {String} type Type of object (eg. 'circle')
|
||||
* @param {String} namespace Namespace to get klass "Class" object from
|
||||
* @return {Object} klass "Class"
|
||||
*/
|
||||
* Returns klass "Class" object of given namespace
|
||||
* @memberOf fabric.util
|
||||
* @param {String} type Type of object (eg. 'circle')
|
||||
* @param {String} namespace Namespace to get klass "Class" object from
|
||||
* @return {Object} klass "Class"
|
||||
*/
|
||||
getKlass: function(type, namespace) {
|
||||
// capitalize first letter only
|
||||
type = fabric.util.string.camelize(type.charAt(0).toUpperCase() + type.slice(1));
|
||||
|
|
|
|||
Loading…
Reference in a new issue