version 1.7.22 hotfix

This commit is contained in:
Asturur 2017-12-29 09:38:15 +01:00
parent d0d50bbfa5
commit 4fe57d3922
7 changed files with 34 additions and 16 deletions

View file

@ -1,3 +1,6 @@
**Version 1.7.22**
- Reverted removal of this.ctx
**Version 1.7.21**
- BACKPORT cache fuzzyness fix part 2
- BACKPORT freedrawing fix part 2

View file

@ -1,6 +1,6 @@
/*! Fabric.js Copyright 2008-2015, Printio (Juriy Zaytsev, Maxim Chernyak) */
var fabric = fabric || { version: "1.7.21" };
var fabric = fabric || { version: "1.7.22" };
if (typeof exports !== 'undefined') {
exports.fabric = fabric;
}

24
dist/fabric.js vendored
View file

@ -1,7 +1,7 @@
/* build: `node build.js modules=ALL exclude=json,gestures minifier=uglifyjs` */
/*! Fabric.js Copyright 2008-2015, Printio (Juriy Zaytsev, Maxim Chernyak) */
var fabric = fabric || { version: "1.7.21" };
var fabric = fabric || { version: "1.7.22" };
if (typeof exports !== 'undefined') {
exports.fabric = fabric;
}
@ -23434,6 +23434,15 @@ fabric.Image.filters.BaseFilter.fromObject = function(object, callback) {
this.renderCursorOrSelection();
},
/**
* @private
* @param {CanvasRenderingContext2D} ctx Context to render on
*/
_render: function(ctx) {
this.callSuper('_render', ctx);
this.ctx = ctx;
},
/**
* Prepare and clean the contextTop
*/
@ -23456,7 +23465,7 @@ fabric.Image.filters.BaseFilter.fromObject = function(object, callback) {
* Renders cursor or selection (depending on what exists)
*/
renderCursorOrSelection: function() {
if (!this.active || !this.isEditing || !this.canvas) {
if (!this.active || !this.isEditing) {
return;
}
var chars = this.text.split(''),
@ -23470,7 +23479,7 @@ fabric.Image.filters.BaseFilter.fromObject = function(object, callback) {
this._clearTextArea(ctx);
}
else {
ctx = this.canvas.contextContainer;
ctx = this.ctx;
ctx.save();
}
if (this.selectionStart === this.selectionEnd) {
@ -24444,8 +24453,7 @@ fabric.Image.filters.BaseFilter.fromObject = function(object, callback) {
* Aborts cursor animation and clears all timeouts
*/
abortCursorAnimation: function() {
var shouldClear = this._currentTickState || this._currentTickCompleteState,
canvas = this.canvas;
var shouldClear = this._currentTickState || this._currentTickCompleteState;
this._currentTickState && this._currentTickState.abort();
this._currentTickCompleteState && this._currentTickCompleteState.abort();
@ -24455,8 +24463,8 @@ fabric.Image.filters.BaseFilter.fromObject = function(object, callback) {
this._currentCursorOpacity = 0;
// to clear just itext area we need to transform the context
// it may not be worth it
if (shouldClear && canvas) {
canvas.clearContext(canvas.contextTop || canvas.contextContainer);
if (shouldClear) {
this.canvas && this.canvas.clearContext(this.canvas.contextTop || this.ctx);
}
},
@ -26295,8 +26303,10 @@ fabric.util.object.extend(fabric.IText.prototype, /** @lends fabric.IText.protot
* @return {fabric.Textbox} thisArg
*/
initialize: function(text, options) {
this.callSuper('initialize', text, options);
this.setControlsVisibility(fabric.Textbox.getTextboxControlVisibility());
this.ctx = this.objectCaching ? this._cacheContext : fabric.util.createCanvasElement().getContext('2d');
},
/**

2
dist/fabric.min.js vendored

File diff suppressed because one or more lines are too long

BIN
dist/fabric.min.js.gz vendored

Binary file not shown.

View file

@ -1,5 +1,5 @@
var fabric = fabric || {
version: "1.7.21"
version: "1.7.22"
};
if (typeof exports !== "undefined") {
@ -10992,6 +10992,10 @@ fabric.Image.filters.BaseFilter.fromObject = function(object, callback) {
this.cursorOffsetCache = {};
this.renderCursorOrSelection();
},
_render: function(ctx) {
this.callSuper("_render", ctx);
this.ctx = ctx;
},
clearContextTop: function() {
if (!this.active || !this.isEditing) {
return;
@ -11007,7 +11011,7 @@ fabric.Image.filters.BaseFilter.fromObject = function(object, callback) {
}
},
renderCursorOrSelection: function() {
if (!this.active || !this.isEditing || !this.canvas) {
if (!this.active || !this.isEditing) {
return;
}
var chars = this.text.split(""), boundaries, ctx;
@ -11019,7 +11023,7 @@ fabric.Image.filters.BaseFilter.fromObject = function(object, callback) {
this.transformMatrix && ctx.transform.apply(ctx, this.transformMatrix);
this._clearTextArea(ctx);
} else {
ctx = this.canvas.contextContainer;
ctx = this.ctx;
ctx.save();
}
if (this.selectionStart === this.selectionEnd) {
@ -11566,14 +11570,14 @@ fabric.Image.filters.BaseFilter.fromObject = function(object, callback) {
}, delay);
},
abortCursorAnimation: function() {
var shouldClear = this._currentTickState || this._currentTickCompleteState, canvas = this.canvas;
var shouldClear = this._currentTickState || this._currentTickCompleteState;
this._currentTickState && this._currentTickState.abort();
this._currentTickCompleteState && this._currentTickCompleteState.abort();
clearTimeout(this._cursorTimeout1);
clearTimeout(this._cursorTimeout2);
this._currentCursorOpacity = 0;
if (shouldClear && canvas) {
canvas.clearContext(canvas.contextTop || canvas.contextContainer);
if (shouldClear) {
this.canvas && this.canvas.clearContext(this.canvas.contextTop || this.ctx);
}
},
selectAll: function() {
@ -12624,6 +12628,7 @@ fabric.util.object.extend(fabric.IText.prototype, {
initialize: function(text, options) {
this.callSuper("initialize", text, options);
this.setControlsVisibility(fabric.Textbox.getTextboxControlVisibility());
this.ctx = this.objectCaching ? this._cacheContext : fabric.util.createCanvasElement().getContext("2d");
},
_initDimensions: function(ctx) {
if (this.__skipDimension) {

View file

@ -2,7 +2,7 @@
"name": "fabric",
"description": "Object model for HTML5 canvas, and SVG-to-canvas parser. Backed by jsdom and node-canvas.",
"homepage": "http://fabricjs.com/",
"version": "1.7.21",
"version": "1.7.22",
"author": "Juriy Zaytsev <kangax@gmail.com>",
"contributors": [
{