Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Fabric PR #7885 #1

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 19 additions & 11 deletions dist/fabric.js
Original file line number Diff line number Diff line change
Expand Up @@ -11716,6 +11716,10 @@ fabric.PatternBrush = fabric.util.createClass(fabric.PencilBrush, /** @lends fab
},

renderTopLayer: function(ctx) {
if (!ctx) {
return;
}

ctx.save();
if (this.isDrawingMode && this._isCurrentlyDrawing) {
this.freeDrawingBrush && this.freeDrawingBrush._render();
Expand Down Expand Up @@ -12484,21 +12488,24 @@ fabric.PatternBrush = fabric.util.createClass(fabric.PencilBrush, /** @lends fab
* @chainable
*/
dispose: function () {
var wrapper = this.wrapperEl;
var wrapperEl = this.wrapperEl,
lowerCanvasEl = this.lowerCanvasEl,
upperCanvasEl = this.upperCanvasEl,
cacheCanvasEl = this.cacheCanvasEl;
this.removeListeners();
wrapper.removeChild(this.upperCanvasEl);
wrapper.removeChild(this.lowerCanvasEl);
this.callSuper('dispose');
wrapperEl.removeChild(upperCanvasEl);
wrapperEl.removeChild(lowerCanvasEl);
this.contextCache = null;
this.contextTop = null;
['upperCanvasEl', 'cacheCanvasEl'].forEach((function(element) {
fabric.util.cleanUpJsdomNode(this[element]);
this[element] = undefined;
}).bind(this));
if (wrapper.parentNode) {
wrapper.parentNode.replaceChild(this.lowerCanvasEl, this.wrapperEl);
fabric.util.cleanUpJsdomNode(upperCanvasEl);
this.upperCanvasEl = undefined;
fabric.util.cleanUpJsdomNode(cacheCanvasEl);
this.cacheCanvasEl = undefined;
if (wrapperEl.parentNode) {
wrapperEl.parentNode.replaceChild(lowerCanvasEl, wrapperEl);
}
delete this.wrapperEl;
fabric.StaticCanvas.prototype.dispose.call(this);
return this;
},

Expand Down Expand Up @@ -13750,6 +13757,7 @@ fabric.PatternBrush = fabric.util.createClass(fabric.PencilBrush, /** @lends fab
selectionX2Y2 = new fabric.Point(max(x1, x2), max(y1, y2)),
allowIntersect,
isClick = x1 === x2 && y1 === y2;

// we iterate reverse order to collect top first in case of click.
for (var i = this._objects.length; i--; ) {
currentObject = this._objects[i];
Expand Down Expand Up @@ -20495,7 +20503,7 @@ fabric.util.object.extend(fabric.Object.prototype, /** @lends fabric.Object.prot
newGroup.set(options);
var firstIndex = null
objects.forEach(function(object) {
// We record the *lowest* index of object in the group. We can't use
// We record the *lowest* index of object in the group. We can't use
// the highest index because in the case of dependent objects, removing
// one from the collection might also trigger removal of others
// changing all of the higher indexes.
Expand Down
2 changes: 1 addition & 1 deletion dist/fabric.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@aha-app/fabric",
"description": "Object model for HTML5 canvas, and SVG-to-canvas parser. Backed by jsdom and node-canvas.",
"homepage": "http://fabricjs.com/",
"version": "4.6.0-aha-3",
"version": "4.6.0-aha-4",
"author": "Juriy Zaytsev <kangax@gmail.com>",
"contributors": [
{
Expand Down
27 changes: 17 additions & 10 deletions src/canvas.class.js
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,10 @@
},

renderTopLayer: function(ctx) {
if (!ctx) {
return;
}

ctx.save();
if (this.isDrawingMode && this._isCurrentlyDrawing) {
this.freeDrawingBrush && this.freeDrawingBrush._render();
Expand Down Expand Up @@ -1199,21 +1203,24 @@
* @chainable
*/
dispose: function () {
var wrapper = this.wrapperEl;
var wrapperEl = this.wrapperEl,
lowerCanvasEl = this.lowerCanvasEl,
upperCanvasEl = this.upperCanvasEl,
cacheCanvasEl = this.cacheCanvasEl;
this.removeListeners();
wrapper.removeChild(this.upperCanvasEl);
wrapper.removeChild(this.lowerCanvasEl);
this.callSuper('dispose');
wrapperEl.removeChild(upperCanvasEl);
wrapperEl.removeChild(lowerCanvasEl);
this.contextCache = null;
this.contextTop = null;
['upperCanvasEl', 'cacheCanvasEl'].forEach((function(element) {
fabric.util.cleanUpJsdomNode(this[element]);
this[element] = undefined;
}).bind(this));
if (wrapper.parentNode) {
wrapper.parentNode.replaceChild(this.lowerCanvasEl, this.wrapperEl);
fabric.util.cleanUpJsdomNode(upperCanvasEl);
this.upperCanvasEl = undefined;
fabric.util.cleanUpJsdomNode(cacheCanvasEl);
this.cacheCanvasEl = undefined;
if (wrapperEl.parentNode) {
wrapperEl.parentNode.replaceChild(lowerCanvasEl, wrapperEl);
}
delete this.wrapperEl;
fabric.StaticCanvas.prototype.dispose.call(this);
return this;
},

Expand Down