Skip to content

Commit

Permalink
Spelling & grammar fixes within mixins (#5568)
Browse files Browse the repository at this point in the history
* Various corrections to spelling/grammar

* added new shadowUniform property to shadow class for non-scaling shadows

* various spelling/grammar corrections

* revert shadow changes to master
  • Loading branch information
melchiar authored and asturur committed Mar 11, 2019
1 parent d9eb0a9 commit abc1ca2
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 37 deletions.
2 changes: 1 addition & 1 deletion src/mixins/canvas_dataurl_exporter.mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
* Create a new HTMLCanvas element painted with the current canvas content.
* No need to resize the actual one or repaint it.
* Will transfer object ownership to a new canvas, paint it, and set everything back.
* This is an intermediary step used to get to a dataUrl but also it is usefull to
* This is an intermediary step used to get to a dataUrl but also it is useful to
* create quick image copies of a canvas without passing for the dataUrl string
* @param {Number} [multiplier] a zoom factor.
* @param {Object} [cropping] Cropping informations
Expand Down
14 changes: 7 additions & 7 deletions src/mixins/canvas_events.mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,7 @@

/**
* Method that defines the actions when mouse is hovering the canvas.
* The currentTransform parameter will definde whether the user is rotating/scaling/translating
* The currentTransform parameter will define 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.
Expand Down Expand Up @@ -715,7 +715,7 @@
* @private
*/
_fireOverOutEvents: function(target, e) {
this.fireSynteticInOutEvents(target, e, {
this.fireSyntheticInOutEvents(target, e, {
targetName: '_hoveredTarget',
canvasEvtOut: 'mouse:out',
evtOut: 'mouseout',
Expand All @@ -731,15 +731,15 @@
* @private
*/
_fireEnterLeaveEvents: function(target, e) {
this.fireSynteticInOutEvents(target, e, {
this.fireSyntheticInOutEvents(target, e, {
targetName: '_draggedoverTarget',
evtOut: 'dragleave',
evtIn: 'dragenter',
});
},

/**
* Manage the syntetic in/out events for the fabric objects on the canvas
* Manage the synthetic in/out events for the fabric objects on the canvas
* @param {Fabric.Object} target the target where the target from the supported events
* @param {Event} e Event object fired
* @param {Object} config configuration for the function to work
Expand All @@ -750,7 +750,7 @@
* @param {String} config.evtIn name of the event to fire for in
* @private
*/
fireSynteticInOutEvents: function(target, e, config) {
fireSyntheticInOutEvents: function(target, e, config) {
var inOpt, outOpt, oldTarget = this[config.targetName], outFires, inFires,
targetChanged = oldTarget !== target, canvasEvtIn = config.canvasEvtIn, canvasEvtOut = config.canvasEvtOut;
if (targetChanged) {
Expand Down Expand Up @@ -871,9 +871,9 @@
/**
* @private
* @param {Event} e Event object
* @param {Object} transform current tranform
* @param {Object} transform current transform
* @param {Number} x mouse position x from origin
* @param {Number} y mouse poistion y from origin
* @param {Number} y mouse position y from origin
* @return {Boolean} true if the scaling occurred
*/
_onScale: function(e, transform, x, y) {
Expand Down
26 changes: 13 additions & 13 deletions src/mixins/itext_behavior.mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@

/**
* Find new selection index representing start of current word according to current selection index
* @param {Number} startFrom Surrent selection index
* @param {Number} startFrom Current selection index
* @return {Number} New selection index
*/
findWordBoundaryLeft: function(startFrom) {
Expand Down Expand Up @@ -511,9 +511,9 @@
if (!this.canvas) {
return { x: 1, y: 1 };
}
var desiredPostion = this.inCompositionMode ? this.compositionStart : this.selectionStart,
boundaries = this._getCursorBoundaries(desiredPostion),
cursorLocation = this.get2DCursorLocation(desiredPostion),
var desiredPosition = this.inCompositionMode ? this.compositionStart : this.selectionStart,
boundaries = this._getCursorBoundaries(desiredPosition),
cursorLocation = this.get2DCursorLocation(desiredPosition),
lineIndex = cursorLocation.lineIndex,
charIndex = cursorLocation.charIndex,
charHeight = this.getValueOfPropertyAt(lineIndex, charIndex, 'fontSize') * this.lineHeight,
Expand Down Expand Up @@ -778,7 +778,7 @@
* @param {Number} lineIndex Index of a line
* @param {Number} charIndex Index of a char
* @param {Number} quantity number Style object to insert, if given
* @param {Array} copiedStyle array of style objecs
* @param {Array} copiedStyle array of style objects
*/
insertCharStyleObject: function(lineIndex, charIndex, quantity, copiedStyle) {
if (!this.styles) {
Expand Down Expand Up @@ -830,23 +830,23 @@
*/
insertNewStyleBlock: function(insertedText, start, copiedStyle) {
var cursorLoc = this.get2DCursorLocation(start, true),
addedLines = [0], linesLenght = 0;
addedLines = [0], linesLength = 0;
for (var i = 0; i < insertedText.length; i++) {
if (insertedText[i] === '\n') {
linesLenght++;
addedLines[linesLenght] = 0;
linesLength++;
addedLines[linesLength] = 0;
}
else {
addedLines[linesLenght]++;
addedLines[linesLength]++;
}
}
if (addedLines[0] > 0) {
this.insertCharStyleObject(cursorLoc.lineIndex, cursorLoc.charIndex, addedLines[0], copiedStyle);
copiedStyle = copiedStyle && copiedStyle.slice(addedLines[0] + 1);
}
linesLenght && this.insertNewlineStyleObject(
cursorLoc.lineIndex, cursorLoc.charIndex + addedLines[0], linesLenght);
for (var i = 1; i < linesLenght; i++) {
linesLength && this.insertNewlineStyleObject(
cursorLoc.lineIndex, cursorLoc.charIndex + addedLines[0], linesLength);
for (var i = 1; i < linesLength; i++) {
if (addedLines[i] > 0) {
this.insertCharStyleObject(cursorLoc.lineIndex + i, 0, addedLines[i], copiedStyle);
}
Expand All @@ -862,7 +862,7 @@
},

/**
* Set the selectionStart and selectionEnd according to the ne postion of cursor
* Set the selectionStart and selectionEnd according to the new position of cursor
* mimic the key - mouse navigation when shift is pressed.
*/
setSelectionStartEndWithShift: function(start, end, newSelection) {
Expand Down
32 changes: 16 additions & 16 deletions src/mixins/object_geometry.mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
* each property is an object with x, y, instance of Fabric.Point.
* The coordinates depends from this properties: width, height, scaleX, scaleY
* skewX, skewY, angle, strokeWidth, top, left.
* Those coordinates are usefull to understand where an object is. They get updated
* Those coordinates are useful to understand where an object is. They get updated
* with oCoords but they do not need to be updated when zoom or panning change.
* The coordinates get updated with @method setCoords.
* You can calculate them without updating with @method calcCoords(true);
Expand Down Expand Up @@ -189,7 +189,7 @@
* @param {Fabric.Point} pointTL Top Left point
* @param {Fabric.Point} pointBR Top Right point
* @param {Boolean} calculate use coordinates of current position instead of .oCoords
* @return {Boolean} true if the objects containe the point
* @return {Boolean} true if the object contains the point
*/
_containsCenterOfCanvas: function(pointTL, pointBR, calculate) {
// worst case scenario the object is so big that contains the screen
Expand Down Expand Up @@ -294,7 +294,7 @@

/**
* Returns coordinates of object's bounding rectangle (left, top, width, height)
* the box is intented as aligned to axis of canvas.
* the box is intended as aligned to axis of canvas.
* @param {Boolean} [absolute] use coordinates without viewportTransform
* @param {Boolean} [calculate] use coordinates of current position instead of .oCoords / .aCoords
* @return {Object} Object with left, top, width, height properties
Expand All @@ -305,7 +305,7 @@
},

/**
* Returns width of an object bounding box counting transformations
* Returns width of an object's bounding box counting transformations
* before 2.0 it was named getWidth();
* @return {Number} width value
*/
Expand Down Expand Up @@ -382,7 +382,7 @@
},

/**
* Calculate and returns the .coords of an object.
* Calculates and returns the .coords of an object.
* @return {Object} Object with tl, tr, br, bl ....
* @chainable
*/
Expand Down Expand Up @@ -457,7 +457,7 @@
* Sets corner position coordinates based on current angle, width and height.
* See {@link https://github.com/kangax/fabric.js/wiki/When-to-call-setCoords|When-to-call-setCoords}
* @param {Boolean} [ignoreZoom] set oCoords with or without the viewport transform.
* @param {Boolean} [skipAbsolute] skip calculation of aCoords, usefull in setViewportTransform
* @param {Boolean} [skipAbsolute] skip calculation of aCoords, useful in setViewportTransform
* @return {fabric.Object} thisArg
* @chainable
*/
Expand Down Expand Up @@ -505,10 +505,10 @@
},

/**
* calculate trasform Matrix that represent current transformation from
* object properties.
* @param {Boolean} [skipGroup] return transformMatrix for object and not go upward with parents
* @return {Array} matrix Transform Matrix for the object
* calculate transform matrix that represents the current transformations from the
* object's properties.
* @param {Boolean} [skipGroup] return transform matrix for object not counting parent transformations
* @return {Array} transform matrix for the object
*/
calcTransformMatrix: function(skipGroup) {
if (skipGroup) {
Expand Down Expand Up @@ -576,7 +576,7 @@
},

/*
* Calculate object bounding boxdimensions from its properties scale, skew.
* Calculate object bounding box dimensions from its properties scale, skew.
* @private
* @return {Object} .x width dimension
* @return {Object} .y height dimension
Expand All @@ -600,7 +600,7 @@
dimY = dimensions.y;
}
if (noSkew) {
return this._finalizeDiemensions(dimX * this.scaleX, dimY * this.scaleY);
return this._finalizeDimensions(dimX * this.scaleX, dimY * this.scaleY);
}
else {
dimX /= 2;
Expand Down Expand Up @@ -629,25 +629,25 @@
points[i] = fabric.util.transformPoint(points[i], transformMatrix);
}
bbox = fabric.util.makeBoundingBoxFromPoints(points);
return this._finalizeDiemensions(bbox.width, bbox.height);
return this._finalizeDimensions(bbox.width, bbox.height);
},

/*
* Calculate object bounding boxdimensions from its properties scale, skew.
* Calculate object bounding box dimensions from its properties scale, skew.
* @param Number width width of the bbox
* @param Number height height of the bbox
* @private
* @return {Object} .x finalized width dimension
* @return {Object} .y finalized height dimension
*/
_finalizeDiemensions: function(width, height) {
_finalizeDimensions: function(width, height) {
return this.strokeUniform ?
{ x: width + this.strokeWidth, y: height + this.strokeWidth }
:
{ x: width, y: height };
},
/*
* Calculate object dimensions for controls. include padding and canvas zoom
* Calculate object dimensions for controls, including padding and canvas zoom.
* private
*/
_calculateCurrentDimensions: function() {
Expand Down

0 comments on commit abc1ca2

Please sign in to comment.