Permalink
Browse files

update to 1715 (#4058)

* update to 1715

* fixed bug
  • Loading branch information...
1 parent 0ce9aa0 commit 4cb2e32ee84c582cbd1a0429c63cbe30fd338087 @asturur asturur committed on GitHub Jul 2, 2017
Showing with 61 additions and 48 deletions.
  1. +5 −0 CHANGELOG.md
  2. +1 −1 HEADER.js
  3. +28 −20 dist/fabric.js
  4. +7 −7 dist/fabric.min.js
  5. BIN dist/fabric.min.js.gz
  6. +17 −17 dist/fabric.require.js
  7. +1 −1 package.json
  8. +2 −2 src/shapes/group.class.js
View
@@ -1,3 +1,8 @@
+**Version 1.7.15**
+
+- Improvement: Made iText keymap public. [#4053](https://github.com/kangax/fabric.js/pull/4053)
+- Improvement: Fix a bug in updateCacheCanvas that was returning always true [#4051](https://github.com/kangax/fabric.js/pull/4051)
+
**Version 1.7.14**
- Improvement: Avoid cache canvas to resize each mouse move step. [#4037](https://github.com/kangax/fabric.js/pull/4037)
View
@@ -1,6 +1,6 @@
/*! Fabric.js Copyright 2008-2015, Printio (Juriy Zaytsev, Maxim Chernyak) */
-var fabric = fabric || { version: "1.7.14" };
+var fabric = fabric || { version: "1.7.15" };
if (typeof exports !== 'undefined') {
exports.fabric = fabric;
}
View
@@ -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.14" };
+var fabric = fabric || { version: "1.7.15" };
if (typeof exports !== 'undefined') {
exports.fabric = fabric;
}
@@ -6850,14 +6850,14 @@ fabric.ElementsParser.prototype.checkIfDone = function() {
* @chainable true
*/
setViewportTransform: function (vpt) {
- var activeGroup = this._activeGroup, object, ingoreVpt = false, skipAbsolute = true;
+ var activeGroup = this._activeGroup, object, ignoreVpt = false, skipAbsolute = true;
this.viewportTransform = vpt;
for (var i = 0, len = this._objects.length; i < len; i++) {
object = this._objects[i];
- object.group || object.setCoords(ingoreVpt, skipAbsolute);
+ object.group || object.setCoords(ignoreVpt, skipAbsolute);
}
if (activeGroup) {
- activeGroup.setCoords(ingoreVpt, skipAbsolute);
+ activeGroup.setCoords(ignoreVpt, skipAbsolute);
}
this.calcViewportBoundaries();
this.renderAll();
@@ -12654,15 +12654,15 @@ fabric.util.object.extend(fabric.StaticCanvas.prototype, /** @lends fabric.Stati
if (shouldResizeCanvas) {
this._cacheCanvas.width = Math.max(Math.ceil(width) + additionalWidth, minCacheSize);
this._cacheCanvas.height = Math.max(Math.ceil(height) + additionalHeight, minCacheSize);
- this.cacheWidth = width;
- this.cacheHeight = height;
this.cacheTranslationX = (width + additionalWidth) / 2;
this.cacheTranslationY = (height + additionalHeight) / 2;
}
else {
this._cacheContext.setTransform(1, 0, 0, 1, 0, 0);
this._cacheContext.clearRect(0, 0, this._cacheCanvas.width, this._cacheCanvas.height);
}
+ this.cacheWidth = width;
+ this.cacheHeight = height;
this._cacheContext.translate(this.cacheTranslationX, this.cacheTranslationY);
this._cacheContext.scale(zoomX, zoomY);
this.zoomX = zoomX;
@@ -12981,7 +12981,7 @@ fabric.util.object.extend(fabric.StaticCanvas.prototype, /** @lends fabric.Stati
* @return {Boolean}
*/
willDrawShadow: function() {
- return !!this.shadow;
+ return !!this.shadow && (this.shadow.offsetX !== 0 || this.shadow.offsetY !== 0);
},
/**
@@ -18610,7 +18610,7 @@ fabric.util.object.extend(fabric.Object.prototype, /** @lends fabric.Object.prot
* @return {Boolean}
*/
willDrawShadow: function() {
- if (this.shadow) {
+ if (this.callSuper('willDrawShadow')) {
return true;
}
for (var i = 0, len = this._objects.length; i < len; i++) {
@@ -25389,9 +25389,17 @@ fabric.util.object.extend(fabric.IText.prototype, /** @lends fabric.IText.protot
},
/**
- * @private
+ * For functionalities on keyDown
+ * Map a special key to a function of the instance/prototype
+ * If you need different behaviour for ESC or TAB or arrows, you have to change
+ * this map setting the name of a function that you build on the fabric.Itext or
+ * your prototype.
+ * the map change will affect all Instances unless you need for only some text Instances
+ * in that case you have to clone this object and assign your Instance.
+ * this.keysMap = fabric.util.object.clone(this.keysMap);
+ * The function must be in fabric.Itext.prototype.myFunction And will receive event as args[0]
*/
- _keysMap: {
+ keysMap: {
8: 'removeChars',
9: 'exitEditing',
27: 'exitEditing',
@@ -25408,17 +25416,17 @@ fabric.util.object.extend(fabric.IText.prototype, /** @lends fabric.IText.protot
},
/**
- * @private
+ * For functionalities on keyUp + ctrl || cmd
*/
- _ctrlKeysMapUp: {
+ ctrlKeysMapUp: {
67: 'copy',
88: 'cut'
},
/**
- * @private
+ * For functionalities on keyDown + ctrl || cmd
*/
- _ctrlKeysMapDown: {
+ ctrlKeysMapDown: {
65: 'selectAll'
},
@@ -25435,11 +25443,11 @@ fabric.util.object.extend(fabric.IText.prototype, /** @lends fabric.IText.protot
if (!this.isEditing) {
return;
}
- if (e.keyCode in this._keysMap) {
- this[this._keysMap[e.keyCode]](e);
+ if (e.keyCode in this.keysMap) {
+ this[this.keysMap[e.keyCode]](e);
}
- else if ((e.keyCode in this._ctrlKeysMapDown) && (e.ctrlKey || e.metaKey)) {
- this[this._ctrlKeysMapDown[e.keyCode]](e);
+ else if ((e.keyCode in this.ctrlKeysMapDown) && (e.ctrlKey || e.metaKey)) {
+ this[this.ctrlKeysMapDown[e.keyCode]](e);
}
else {
return;
@@ -25467,8 +25475,8 @@ fabric.util.object.extend(fabric.IText.prototype, /** @lends fabric.IText.protot
this._copyDone = false;
return;
}
- if ((e.keyCode in this._ctrlKeysMapUp) && (e.ctrlKey || e.metaKey)) {
- this[this._ctrlKeysMapUp[e.keyCode]](e);
+ if ((e.keyCode in this.ctrlKeysMapUp) && (e.ctrlKey || e.metaKey)) {
+ this[this.ctrlKeysMapUp[e.keyCode]](e);
}
else {
return;
View

Large diffs are not rendered by default.

Oops, something went wrong.
View
Binary file not shown.
View
@@ -1,5 +1,5 @@
var fabric = fabric || {
- version: "1.7.14"
+ version: "1.7.15"
};
if (typeof exports !== "undefined") {
@@ -3468,14 +3468,14 @@ fabric.ElementsParser.prototype.checkIfDone = function() {
return this.viewportTransform[0];
},
setViewportTransform: function(vpt) {
- var activeGroup = this._activeGroup, object, ingoreVpt = false, skipAbsolute = true;
+ var activeGroup = this._activeGroup, object, ignoreVpt = false, skipAbsolute = true;
this.viewportTransform = vpt;
for (var i = 0, len = this._objects.length; i < len; i++) {
object = this._objects[i];
- object.group || object.setCoords(ingoreVpt, skipAbsolute);
+ object.group || object.setCoords(ignoreVpt, skipAbsolute);
}
if (activeGroup) {
- activeGroup.setCoords(ingoreVpt, skipAbsolute);
+ activeGroup.setCoords(ignoreVpt, skipAbsolute);
}
this.calcViewportBoundaries();
this.renderAll();
@@ -6128,14 +6128,14 @@ fabric.util.object.extend(fabric.StaticCanvas.prototype, {
if (shouldResizeCanvas) {
this._cacheCanvas.width = Math.max(Math.ceil(width) + additionalWidth, minCacheSize);
this._cacheCanvas.height = Math.max(Math.ceil(height) + additionalHeight, minCacheSize);
- this.cacheWidth = width;
- this.cacheHeight = height;
this.cacheTranslationX = (width + additionalWidth) / 2;
this.cacheTranslationY = (height + additionalHeight) / 2;
} else {
this._cacheContext.setTransform(1, 0, 0, 1, 0, 0);
this._cacheContext.clearRect(0, 0, this._cacheCanvas.width, this._cacheCanvas.height);
}
+ this.cacheWidth = width;
+ this.cacheHeight = height;
this._cacheContext.translate(this.cacheTranslationX, this.cacheTranslationY);
this._cacheContext.scale(zoomX, zoomY);
this.zoomX = zoomX;
@@ -6327,7 +6327,7 @@ fabric.util.object.extend(fabric.StaticCanvas.prototype, {
return !noTransform && this.objectCaching && (!this.group || this.needsItsOwnCache() || !this.group.isCaching());
},
willDrawShadow: function() {
- return !!this.shadow;
+ return !!this.shadow && (this.shadow.offsetX !== 0 || this.shadow.offsetY !== 0);
},
drawObject: function(ctx, noTransform) {
this._renderBackground(ctx);
@@ -8983,7 +8983,7 @@ fabric.util.object.extend(fabric.Object.prototype, {
return parentCache;
},
willDrawShadow: function() {
- if (this.shadow) {
+ if (this.callSuper("willDrawShadow")) {
return true;
}
for (var i = 0, len = this._objects.length; i < len; i++) {
@@ -12132,7 +12132,7 @@ fabric.util.object.extend(fabric.IText.prototype, {
this._clickHandlerInitialized = true;
}
},
- _keysMap: {
+ keysMap: {
8: "removeChars",
9: "exitEditing",
27: "exitEditing",
@@ -12147,11 +12147,11 @@ fabric.util.object.extend(fabric.IText.prototype, {
40: "moveCursorDown",
46: "forwardDelete"
},
- _ctrlKeysMapUp: {
+ ctrlKeysMapUp: {
67: "copy",
88: "cut"
},
- _ctrlKeysMapDown: {
+ ctrlKeysMapDown: {
65: "selectAll"
},
onClick: function() {
@@ -12161,10 +12161,10 @@ fabric.util.object.extend(fabric.IText.prototype, {
if (!this.isEditing) {
return;
}
- if (e.keyCode in this._keysMap) {
- this[this._keysMap[e.keyCode]](e);
- } else if (e.keyCode in this._ctrlKeysMapDown && (e.ctrlKey || e.metaKey)) {
- this[this._ctrlKeysMapDown[e.keyCode]](e);
+ if (e.keyCode in this.keysMap) {
+ this[this.keysMap[e.keyCode]](e);
+ } else if (e.keyCode in this.ctrlKeysMapDown && (e.ctrlKey || e.metaKey)) {
+ this[this.ctrlKeysMapDown[e.keyCode]](e);
} else {
return;
}
@@ -12182,8 +12182,8 @@ fabric.util.object.extend(fabric.IText.prototype, {
this._copyDone = false;
return;
}
- if (e.keyCode in this._ctrlKeysMapUp && (e.ctrlKey || e.metaKey)) {
- this[this._ctrlKeysMapUp[e.keyCode]](e);
+ if (e.keyCode in this.ctrlKeysMapUp && (e.ctrlKey || e.metaKey)) {
+ this[this.ctrlKeysMapUp[e.keyCode]](e);
} else {
return;
}
View
@@ -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.14",
+ "version": "1.7.15",
"author": "Juriy Zaytsev <kangax@gmail.com>",
"contributors": [
{
@@ -330,8 +330,8 @@
* @return {Boolean}
*/
willDrawShadow: function() {
- if (this.shadow) {
- return this.callSuper('willDrawShadow');
+ if (this.callSuper('willDrawShadow')) {
+ return true;
}
for (var i = 0, len = this._objects.length; i < len; i++) {
if (this._objects[i].willDrawShadow()) {

0 comments on commit 4cb2e32

Please sign in to comment.