Skip to content

Commit

Permalink
updated to rc2
Browse files Browse the repository at this point in the history
  • Loading branch information
asturur committed Nov 24, 2017
1 parent 7fdccee commit 1952bf5
Show file tree
Hide file tree
Showing 72 changed files with 16,086 additions and 12,537 deletions.
3 changes: 2 additions & 1 deletion build/files/HEADER.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*! Fabric.js Copyright 2008-2015, Printio (Juriy Zaytsev, Maxim Chernyak) */

var fabric = fabric || { version: '2.0.0-rc.1' };
var fabric = fabric || { version: '2.0.0-rc.2' };
if (typeof exports !== 'undefined') {
exports.fabric = fabric;
}
Expand All @@ -18,6 +18,7 @@ else {
FetchExternalResources: ['img']
}
});
fabric.jsdomImplForWrapper = require('jsdom/lib/jsdom/living/generated/utils').implForWrapper;
fabric.window = fabric.document.defaultView;
DOMParser = require('xmldom').DOMParser;
}
Expand Down
2 changes: 1 addition & 1 deletion build/files/src/mixins/itext_behavior.mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@
return;
}

this.hoverCursor = this._savedProps.overCursor;
this.hoverCursor = this._savedProps.hoverCursor;
this.hasControls = this._savedProps.hasControls;
this.borderColor = this._savedProps.borderColor;
this.lockMovementX = this._savedProps.lockMovementX;
Expand Down
56 changes: 13 additions & 43 deletions build/files/src/mixins/itext_key_behavior.mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -591,55 +591,25 @@ fabric.util.object.extend(fabric.IText.prototype, /** @lends fabric.IText.protot
},

/**
* Removes characters selected by selection
* @param {Event} e Event object
*/
removeChars: function(e) {
if (this.selectionStart === this.selectionEnd) {
this._removeCharsNearCursor(e);
}
else {
this._removeCharsFromTo(this.selectionStart, this.selectionEnd);
}

* Removes characters from start/end
* start/end ar per grapheme position in _text array.
*
* @param {Number} start
* @param {Number} end default to start + 1
*/
removeChars: function(start, end) {
if (typeof end === 'undefined') {
end = start + 1;
}
this.removeStyleFromTo(start, end);
this._text.splice(start, end - start);
this.text = this._text.join('');
this.set('dirty', true);
this.setSelectionEnd(this.selectionStart);

this._removeExtraneousStyles();
if (this._shouldClearDimensionCache()) {
this.initDimensions();
this.setCoords();
}
this.canvas && this.canvas.requestRenderAll();
this.fire('changed');
this.canvas && this.canvas.fire('text:changed', { target: this });
},

/**
* @private
* @param {Event} e Event object
*/
_removeCharsNearCursor: function(e) {
if (this.selectionStart === 0) {
return;
}
if (e.metaKey) {
// remove all till the start of current line
var leftLineBoundary = this.findLineBoundaryLeft(this.selectionStart);

this._removeCharsFromTo(leftLineBoundary, this.selectionStart);
this.setSelectionStart(leftLineBoundary);
}
else if (e.altKey) {
// remove all till the start of current word
var leftWordBoundary = this.findWordBoundaryLeft(this.selectionStart);

this._removeCharsFromTo(leftWordBoundary, this.selectionStart);
this.setSelectionStart(leftWordBoundary);
}
else {
this._removeSingleCharAndStyle(this.selectionStart);
this.setSelectionStart(this.selectionStart - 1);
}
}
});
10 changes: 10 additions & 0 deletions build/files/src/static_canvas.class.js
Original file line number Diff line number Diff line change
Expand Up @@ -1759,4 +1759,14 @@
*/
fabric.StaticCanvas.prototype.toJSON = fabric.StaticCanvas.prototype.toObject;

if (fabric.isLikelyNode) {
fabric.StaticCanvas.prototype.createPNGStream = function() {
var impl = fabric.jsdomImplForWrapper(this.lowerCanvasEl);
return impl && impl.createPNGStream();
};
fabric.StaticCanvas.prototype.createJPEGStream = function(opts) {
var impl = fabric.jsdomImplForWrapper(this.lowerCanvasEl);
return impl && impl.createJPEGStream(opts);
};
}
})();
2 changes: 1 addition & 1 deletion build/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
}
</style>

<div class="version">Fabric version: <b>2.0.0 - rc 1</b></div>
<div class="version">Fabric version: <b>2.0.0 - rc 2</b></div>
<h1>FabricJS builder</h1>
<div style="margin-top: 10px">
<button id="select-all">Select all</button>
Expand Down
Loading

0 comments on commit 1952bf5

Please sign in to comment.