mirror of
https://github.com/Hopiu/fabric.js.git
synced 2026-03-16 22:10:32 +00:00
Bump to 1.6.3 (#3080)
This commit is contained in:
parent
cf95dd45c9
commit
725d48771f
10 changed files with 92 additions and 51 deletions
25
CHANGELOG.md
25
CHANGELOG.md
|
|
@ -1,3 +1,26 @@
|
|||
**Version 1.6.3**
|
||||
|
||||
- Improvement: Use reviver callback for background and overlay image when doing svg export. [#2975](https://github.com/kangax/fabric.js/pull/2975)
|
||||
- Improvement: Added object property excludeFromExport to avoid exporting the object to JSON or to SVG. [#2976](https://github.com/kangax/fabric.js/pull/2976)
|
||||
- Improvement: Correct the calculation of text boundingbox. Improves svg import [#2992](https://github.com/kangax/fabric.js/pull/2992)
|
||||
- Added: Export id property to SVG [#2993](https://github.com/kangax/fabric.js/pull/2993)
|
||||
- Improvement: Call the callback on loadSvgFromURL on failed xml load with null agument [#2994](https://github.com/kangax/fabric.js/pull/2994)
|
||||
- Improvement: Clear only the Itext area on contextTop during cursor animation [#2996](https://github.com/kangax/fabric.js/pull/2996)
|
||||
- Added: Char widths cache has been moved to fabric level and not iText level. Added fabric.util.clearFabricCharWidthsCache(fontName) [#2995](https://github.com/kangax/fabric.js/pull/2995)
|
||||
- Fix: do not set background or overlay image if the url load fails. [#3003](https://github.com/kangax/fabric.js/pull/3003)
|
||||
- Fix: iText mousemove event removal, clear the correct area for Itext, stopped redrawing selection if not necessary [#3016](https://github.com/kangax/fabric.js/pull/3016)
|
||||
- Fix: background image and overlay image scale and move with canvas viewportTransform, parameter available [#3019](https://github.com/kangax/fabric.js/pull/3019)
|
||||
- Added: support sub targeting in groups in events [#2997](https://github.com/kangax/fabric.js/pull/2997)
|
||||
- Fix: Select transparent object on mouse up because of _maybeGroupObject [#2997](https://github.com/kangax/fabric.js/pull/2997)
|
||||
- Fix: Remove reference to lastRenderedObject on canvas.remove [#3023](https://github.com/kangax/fabric.js/pull/3023)
|
||||
- Fix: Wait for all objects to be loaded before deleting the properties and setting options. [#3029](https://github.com/kangax/fabric.js/pull/3029)
|
||||
- Fix: Object Padding is unaffected by object transform. [#3057](https://github.com/kangax/fabric.js/pull/3057)
|
||||
- Fix: Restore lastRenderedObject usage. Introduced Canvas.lastRenderedKey to retrieve the lastRendered object from down the stack [#3057](https://github.com/kangax/fabric.js/pull/3057)
|
||||
- Fix: _calcTextareaPosition correctly calculate the position considering the viewportTransform. [#3057](https://github.com/kangax/fabric.js/pull/3057)
|
||||
- Fix: Fixed selectionBacgroundColor with viewport transform. [#3057](https://github.com/kangax/fabric.js/pull/3057)
|
||||
- Improvement: Correctly render the cursor with viewport scaling, improved the cursor centering. [#3057](https://github.com/kangax/fabric.js/pull/3057)
|
||||
- Fix: Use canvas zoom and pan when using is target transparent. [#2980](https://github.com/kangax/fabric.js/pull/2980)
|
||||
|
||||
**Version 1.6.2**
|
||||
|
||||
- Fix: restore canvas properties on loadFromJSON with includeProperties. [#2921](https://github.com/kangax/fabric.js/pull/2921)
|
||||
|
|
@ -41,7 +64,7 @@ Added object.moveCursor to specify a cursor for moving per object. [#2924](https
|
|||
|
||||
- Fix rendering of activeGroup objects while preserveObjectStacking is active. [ regression from [#2083](https://github.com/kangax/fabric.js/pull/2083) ]
|
||||
- Fix `fabric.Path` initialize with user options [#2117](https://github.com/kangax/fabric.js/pull/2117)
|
||||
- Fix sorting of objects in activeGroup during rendering [#2130](https://github.com/kangax/fabric.js/pull/2130).
|
||||
- Fix sorting of objects in activeGroup during rendering [#2130](https://github.com/kangax/fabric.js/pull/2130).
|
||||
- Make sure that 'object.canvas' property is always set if the object is directly or indirectly on canvas [#2141](https://github.com/kangax/fabric.js/pull/2141)
|
||||
- Fix _getTopLeftCoords function that was returning TopCenter [#2127](https://github.com/kangax/fabric.js/pull/2127)
|
||||
- Fix events not being fired after resize with pinch zoom [#510](https://github.com/kangax/fabric.js/pull/510)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*! Fabric.js Copyright 2008-2015, Printio (Juriy Zaytsev, Maxim Chernyak) */
|
||||
|
||||
var fabric = fabric || { version: "1.6.2" };
|
||||
var fabric = fabric || { version: "1.6.3" };
|
||||
if (typeof exports !== 'undefined') {
|
||||
exports.fabric = fabric;
|
||||
}
|
||||
|
|
|
|||
40
dist/fabric.js
vendored
40
dist/fabric.js
vendored
|
|
@ -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.6.2" };
|
||||
var fabric = fabric || { version: "1.6.3" };
|
||||
if (typeof exports !== 'undefined') {
|
||||
exports.fabric = fabric;
|
||||
}
|
||||
|
|
@ -6715,19 +6715,20 @@ fabric.Pattern = fabric.util.createClass(/** @lends fabric.Pattern.prototype */
|
|||
*/
|
||||
_chooseObjectsToRender: function() {
|
||||
var activeGroup = this.getActiveGroup(),
|
||||
activeObject = this.getActiveObject(),
|
||||
object, objsToRender = [ ], activeGroupObjects = [ ];
|
||||
|
||||
if (activeGroup && !this.preserveObjectStacking) {
|
||||
if ((activeGroup || activeObject) && !this.preserveObjectStacking) {
|
||||
for (var i = 0, length = this._objects.length; i < length; i++) {
|
||||
object = this._objects[i];
|
||||
if (!activeGroup.contains(object)) {
|
||||
if ((!activeGroup || !activeGroup.contains(object)) && object !== activeObject) {
|
||||
objsToRender.push(object);
|
||||
}
|
||||
else {
|
||||
activeGroupObjects.push(object);
|
||||
}
|
||||
}
|
||||
activeGroup._set('_objects', activeGroupObjects);
|
||||
activeGroup && activeGroup._set('_objects', activeGroupObjects);
|
||||
}
|
||||
else {
|
||||
objsToRender = this._objects;
|
||||
|
|
@ -6762,7 +6763,10 @@ fabric.Pattern = fabric.util.createClass(/** @lends fabric.Pattern.prototype */
|
|||
//apply viewport transform once for all rendering process
|
||||
canvasToDrawOn.transform.apply(canvasToDrawOn, this.viewportTransform);
|
||||
this._renderObjects(canvasToDrawOn, objsToRender);
|
||||
this.preserveObjectStacking || this._renderObjects(canvasToDrawOn, [this.getActiveGroup()]);
|
||||
if (!this.preserveObjectStacking) {
|
||||
objsToRender = [this.getActiveGroup(), this.getActiveObject()];
|
||||
this._renderObjects(canvasToDrawOn, objsToRender);
|
||||
}
|
||||
canvasToDrawOn.restore();
|
||||
|
||||
if (!this.controlsAboveOverlay && this.interactive) {
|
||||
|
|
@ -9269,16 +9273,17 @@ fabric.PatternBrush = fabric.util.createClass(fabric.PencilBrush, /** @lends fab
|
|||
return;
|
||||
}
|
||||
|
||||
var pointer = this.getPointer(e, true),
|
||||
activeGroup = this.getActiveGroup();
|
||||
|
||||
// first check current group (if one exists)
|
||||
// avtive group does not check sub targets like normal groups.
|
||||
// active group does not check sub targets like normal groups.
|
||||
// if active group just exits.
|
||||
var activeGroup = this.getActiveGroup();
|
||||
if (activeGroup && !skipGroup && this._checkTarget(pointer, activeGroup)) {
|
||||
return activeGroup;
|
||||
}
|
||||
|
||||
var pointer = this.getPointer(e, true),
|
||||
objects = this._objects;
|
||||
var objects = this._objects;
|
||||
this.targets = [ ];
|
||||
|
||||
if (this._isLastRenderedObject(pointer, e)) {
|
||||
|
|
@ -21426,13 +21431,16 @@ fabric.Image.filters.BaseFilter = fabric.util.createClass(/** @lends fabric.Imag
|
|||
textContent = textContent.replace(/^\s+|\s+$|\n+/g, '').replace(/\s+/g, ' ');
|
||||
|
||||
var text = new fabric.Text(textContent, options),
|
||||
/*
|
||||
Adjust positioning:
|
||||
x/y attributes in SVG correspond to the bottom-left corner of text bounding box
|
||||
top/left properties in Fabric correspond to center point of text bounding box
|
||||
*/
|
||||
textHeightScaleFactor = text.getHeight() / text.height,
|
||||
lineHeightDiff = (text.height + text.strokeWidth) * text.lineHeight - text.height,
|
||||
scaledDiff = lineHeightDiff * textHeightScaleFactor,
|
||||
textHeight = text.getHeight() + scaledDiff,
|
||||
offX = 0;
|
||||
|
||||
/*
|
||||
Adjust positioning:
|
||||
x/y attributes in SVG correspond to the bottom-left corner of text bounding box
|
||||
top/left properties in Fabric correspond to center point of text bounding box
|
||||
*/
|
||||
if (text.originX === 'left') {
|
||||
offX = text.getWidth() / 2;
|
||||
}
|
||||
|
|
@ -21441,7 +21449,7 @@ fabric.Image.filters.BaseFilter = fabric.util.createClass(/** @lends fabric.Imag
|
|||
}
|
||||
text.set({
|
||||
left: text.getLeft() + offX,
|
||||
top: text.getTop() - text.getHeight() / 2 + text.fontSize * (0.18 + text._fontSizeFraction) /* 0.3 is the old lineHeight */
|
||||
top: text.getTop() - textHeight / 2 + text.fontSize * (0.18 + text._fontSizeFraction) / text.lineHeight /* 0.3 is the old lineHeight */
|
||||
});
|
||||
|
||||
return text;
|
||||
|
|
|
|||
16
dist/fabric.min.js
vendored
16
dist/fabric.min.js
vendored
File diff suppressed because one or more lines are too long
BIN
dist/fabric.min.js.gz
vendored
BIN
dist/fabric.min.js.gz
vendored
Binary file not shown.
23
dist/fabric.require.js
vendored
23
dist/fabric.require.js
vendored
|
|
@ -1,5 +1,5 @@
|
|||
var fabric = fabric || {
|
||||
version: "1.6.2"
|
||||
version: "1.6.3"
|
||||
};
|
||||
|
||||
if (typeof exports !== "undefined") {
|
||||
|
|
@ -3403,17 +3403,17 @@ fabric.Pattern = fabric.util.createClass({
|
|||
return this;
|
||||
},
|
||||
_chooseObjectsToRender: function() {
|
||||
var activeGroup = this.getActiveGroup(), object, objsToRender = [], activeGroupObjects = [];
|
||||
if (activeGroup && !this.preserveObjectStacking) {
|
||||
var activeGroup = this.getActiveGroup(), activeObject = this.getActiveObject(), object, objsToRender = [], activeGroupObjects = [];
|
||||
if ((activeGroup || activeObject) && !this.preserveObjectStacking) {
|
||||
for (var i = 0, length = this._objects.length; i < length; i++) {
|
||||
object = this._objects[i];
|
||||
if (!activeGroup.contains(object)) {
|
||||
if ((!activeGroup || !activeGroup.contains(object)) && object !== activeObject) {
|
||||
objsToRender.push(object);
|
||||
} else {
|
||||
activeGroupObjects.push(object);
|
||||
}
|
||||
}
|
||||
activeGroup._set("_objects", activeGroupObjects);
|
||||
activeGroup && activeGroup._set("_objects", activeGroupObjects);
|
||||
} else {
|
||||
objsToRender = this._objects;
|
||||
}
|
||||
|
|
@ -3434,7 +3434,10 @@ fabric.Pattern = fabric.util.createClass({
|
|||
objsToRender = this._chooseObjectsToRender();
|
||||
canvasToDrawOn.transform.apply(canvasToDrawOn, this.viewportTransform);
|
||||
this._renderObjects(canvasToDrawOn, objsToRender);
|
||||
this.preserveObjectStacking || this._renderObjects(canvasToDrawOn, [ this.getActiveGroup() ]);
|
||||
if (!this.preserveObjectStacking) {
|
||||
objsToRender = [ this.getActiveGroup(), this.getActiveObject() ];
|
||||
this._renderObjects(canvasToDrawOn, objsToRender);
|
||||
}
|
||||
canvasToDrawOn.restore();
|
||||
if (!this.controlsAboveOverlay && this.interactive) {
|
||||
this.drawControls(canvasToDrawOn);
|
||||
|
|
@ -4620,11 +4623,11 @@ fabric.PatternBrush = fabric.util.createClass(fabric.PencilBrush, {
|
|||
if (this.skipTargetFind) {
|
||||
return;
|
||||
}
|
||||
var activeGroup = this.getActiveGroup();
|
||||
var pointer = this.getPointer(e, true), activeGroup = this.getActiveGroup();
|
||||
if (activeGroup && !skipGroup && this._checkTarget(pointer, activeGroup)) {
|
||||
return activeGroup;
|
||||
}
|
||||
var pointer = this.getPointer(e, true), objects = this._objects;
|
||||
var objects = this._objects;
|
||||
this.targets = [];
|
||||
if (this._isLastRenderedObject(pointer, e)) {
|
||||
objects = [ this.lastRenderedWithControls ];
|
||||
|
|
@ -10058,7 +10061,7 @@ fabric.Image.filters.BaseFilter = fabric.util.createClass({
|
|||
textContent = element.textContent;
|
||||
}
|
||||
textContent = textContent.replace(/^\s+|\s+$|\n+/g, "").replace(/\s+/g, " ");
|
||||
var text = new fabric.Text(textContent, options), offX = 0;
|
||||
var text = new fabric.Text(textContent, options), textHeightScaleFactor = text.getHeight() / text.height, lineHeightDiff = (text.height + text.strokeWidth) * text.lineHeight - text.height, scaledDiff = lineHeightDiff * textHeightScaleFactor, textHeight = text.getHeight() + scaledDiff, offX = 0;
|
||||
if (text.originX === "left") {
|
||||
offX = text.getWidth() / 2;
|
||||
}
|
||||
|
|
@ -10067,7 +10070,7 @@ fabric.Image.filters.BaseFilter = fabric.util.createClass({
|
|||
}
|
||||
text.set({
|
||||
left: text.getLeft() + offX,
|
||||
top: text.getTop() - text.getHeight() / 2 + text.fontSize * (.18 + text._fontSizeFraction)
|
||||
top: text.getTop() - textHeight / 2 + text.fontSize * (.18 + text._fontSizeFraction) / text.lineHeight
|
||||
});
|
||||
return text;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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.6.2",
|
||||
"version": "1.6.3",
|
||||
"author": "Juriy Zaytsev <kangax@gmail.com>",
|
||||
"keywords": [
|
||||
"canvas",
|
||||
|
|
@ -39,7 +39,7 @@
|
|||
"all": "npm run build && npm run test && npm run lint && npm run lint_tests && npm run export_dist_to_site && npm run export_tests_to_site"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"canvas": "1.3.x",
|
||||
"canvas": "1.4.x",
|
||||
"jsdom": "3.x.x",
|
||||
"xmldom": "0.1.x"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1181,13 +1181,16 @@
|
|||
textContent = textContent.replace(/^\s+|\s+$|\n+/g, '').replace(/\s+/g, ' ');
|
||||
|
||||
var text = new fabric.Text(textContent, options),
|
||||
/*
|
||||
Adjust positioning:
|
||||
x/y attributes in SVG correspond to the bottom-left corner of text bounding box
|
||||
top/left properties in Fabric correspond to center point of text bounding box
|
||||
*/
|
||||
textHeightScaleFactor = text.getHeight() / text.height,
|
||||
lineHeightDiff = (text.height + text.strokeWidth) * text.lineHeight - text.height,
|
||||
scaledDiff = lineHeightDiff * textHeightScaleFactor,
|
||||
textHeight = text.getHeight() + scaledDiff,
|
||||
offX = 0;
|
||||
|
||||
/*
|
||||
Adjust positioning:
|
||||
x/y attributes in SVG correspond to the bottom-left corner of text bounding box
|
||||
top/left properties in Fabric correspond to center point of text bounding box
|
||||
*/
|
||||
if (text.originX === 'left') {
|
||||
offX = text.getWidth() / 2;
|
||||
}
|
||||
|
|
@ -1196,7 +1199,7 @@
|
|||
}
|
||||
text.set({
|
||||
left: text.getLeft() + offX,
|
||||
top: text.getTop() - text.getHeight() / 2 + text.fontSize * (0.18 + text._fontSizeFraction) /* 0.3 is the old lineHeight */
|
||||
top: text.getTop() - textHeight / 2 + text.fontSize * (0.18 + text._fontSizeFraction) / text.lineHeight /* 0.3 is the old lineHeight */
|
||||
});
|
||||
|
||||
return text;
|
||||
|
|
|
|||
|
|
@ -842,19 +842,20 @@
|
|||
*/
|
||||
_chooseObjectsToRender: function() {
|
||||
var activeGroup = this.getActiveGroup(),
|
||||
activeObject = this.getActiveObject(),
|
||||
object, objsToRender = [ ], activeGroupObjects = [ ];
|
||||
|
||||
if (activeGroup && !this.preserveObjectStacking) {
|
||||
if ((activeGroup || activeObject) && !this.preserveObjectStacking) {
|
||||
for (var i = 0, length = this._objects.length; i < length; i++) {
|
||||
object = this._objects[i];
|
||||
if (!activeGroup.contains(object)) {
|
||||
if ((!activeGroup || !activeGroup.contains(object)) && object !== activeObject) {
|
||||
objsToRender.push(object);
|
||||
}
|
||||
else {
|
||||
activeGroupObjects.push(object);
|
||||
}
|
||||
}
|
||||
activeGroup._set('_objects', activeGroupObjects);
|
||||
activeGroup && activeGroup._set('_objects', activeGroupObjects);
|
||||
}
|
||||
else {
|
||||
objsToRender = this._objects;
|
||||
|
|
@ -889,7 +890,10 @@
|
|||
//apply viewport transform once for all rendering process
|
||||
canvasToDrawOn.transform.apply(canvasToDrawOn, this.viewportTransform);
|
||||
this._renderObjects(canvasToDrawOn, objsToRender);
|
||||
this.preserveObjectStacking || this._renderObjects(canvasToDrawOn, [this.getActiveGroup()]);
|
||||
if (!this.preserveObjectStacking) {
|
||||
objsToRender = [this.getActiveGroup(), this.getActiveObject()];
|
||||
this._renderObjects(canvasToDrawOn, objsToRender);
|
||||
}
|
||||
canvasToDrawOn.restore();
|
||||
|
||||
if (!this.controlsAboveOverlay && this.interactive) {
|
||||
|
|
|
|||
|
|
@ -180,7 +180,7 @@
|
|||
|
||||
var expectedObject = fabric.util.object.extend(fabric.util.object.clone(REFERENCE_TEXT_OBJECT), {
|
||||
left: 4,
|
||||
top: -2.16,
|
||||
top: -5.14,
|
||||
width: 8,
|
||||
height: 18.08,
|
||||
fontSize: 16,
|
||||
|
|
@ -221,7 +221,7 @@
|
|||
var expectedObject = fabric.util.object.extend(fabric.util.object.clone(REFERENCE_TEXT_OBJECT), {
|
||||
/* left varies slightly due to node-canvas rendering */
|
||||
left: fabric.util.toFixed(textWithAttrs.left + '', 2),
|
||||
top: 3.4,
|
||||
top: -16.76,
|
||||
width: CHAR_WIDTH,
|
||||
height: 138.99,
|
||||
fill: 'rgb(255,255,255)',
|
||||
|
|
|
|||
Loading…
Reference in a new issue