mirror of
https://github.com/Hopiu/fabric.js.git
synced 2026-03-16 22:10:32 +00:00
parent
3a92eb92ae
commit
dfb5cb7a79
5 changed files with 40 additions and 19 deletions
|
|
@ -1,3 +1,9 @@
|
|||
**Version 2.0.3**
|
||||
- Fix: now sub target check can work with subclasses of fabric.Group [#4753](https://github.com/kangax/fabric.js/pull/4753)
|
||||
- Improvement: PencilBrush is now compexity 1 instead of complexity N during draw [#4743](https://github.com/kangax/fabric.js/pull/4743)
|
||||
- Fix the cleanStyle was not checking for the right property to exist [#4751](https://github.com/kangax/fabric.js/pull/4751)
|
||||
- Fix onBeforeScaleRotate with canvas zoom [#4748](https://github.com/kangax/fabric.js/pull/4748)
|
||||
|
||||
**Version 2.0.2**
|
||||
- fixed image toSVG support for crop [#4738](https://github.com/kangax/fabric.js/pull/4738)
|
||||
- changed math for better rounded results [#4734](https://github.com/kangax/fabric.js/pull/4734)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*! Fabric.js Copyright 2008-2015, Printio (Juriy Zaytsev, Maxim Chernyak) */
|
||||
|
||||
var fabric = fabric || { version: '2.0.2' };
|
||||
var fabric = fabric || { version: '2.0.3' };
|
||||
if (typeof exports !== 'undefined') {
|
||||
exports.fabric = fabric;
|
||||
}
|
||||
|
|
|
|||
47
dist/fabric.js
vendored
47
dist/fabric.js
vendored
|
|
@ -1,7 +1,7 @@
|
|||
/* build: `node build.js modules=ALL exclude=gestures,accessors minifier=uglifyjs` */
|
||||
/*! Fabric.js Copyright 2008-2015, Printio (Juriy Zaytsev, Maxim Chernyak) */
|
||||
|
||||
var fabric = fabric || { version: '2.0.2' };
|
||||
var fabric = fabric || { version: '2.0.3' };
|
||||
if (typeof exports !== 'undefined') {
|
||||
exports.fabric = fabric;
|
||||
}
|
||||
|
|
@ -8268,6 +8268,16 @@ fabric.BaseBrush = fabric.util.createClass(/** @lends fabric.BaseBrush.prototype
|
|||
this._points = [];
|
||||
},
|
||||
|
||||
/**
|
||||
* Invoked inside on mouse down and mouse move
|
||||
* @param {Object} pointer
|
||||
*/
|
||||
_drawSegment: function (ctx, p1, p2) {
|
||||
var midPoint = p1.midPointFrom(p2);
|
||||
ctx.quadraticCurveTo(p1.x, p1.y, midPoint.x, midPoint.y);
|
||||
return midPoint;
|
||||
},
|
||||
|
||||
/**
|
||||
* Inovoked on mouse down
|
||||
* @param {Object} pointer
|
||||
|
|
@ -8285,17 +8295,25 @@ fabric.BaseBrush = fabric.util.createClass(/** @lends fabric.BaseBrush.prototype
|
|||
* @param {Object} pointer
|
||||
*/
|
||||
onMouseMove: function(pointer) {
|
||||
this._captureDrawingPath(pointer);
|
||||
// redraw curve
|
||||
// clear top canvas
|
||||
this.canvas.clearContext(this.canvas.contextTop);
|
||||
this._render();
|
||||
if (this._captureDrawingPath(pointer) && this._points.length > 1) {
|
||||
var points = this._points, length = points.length, ctx = this.canvas.contextTop;
|
||||
// draw the curve update
|
||||
this._saveAndTransform(ctx);
|
||||
if (this.oldEnd) {
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(this.oldEnd.x, this.oldEnd.y);
|
||||
}
|
||||
this.oldEnd = this._drawSegment(ctx, points[length - 2], points[length - 1], true);
|
||||
ctx.stroke();
|
||||
ctx.restore();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Invoked on mouse up
|
||||
*/
|
||||
onMouseUp: function() {
|
||||
this.oldEnd = undefined;
|
||||
this._finalizeAndAddPath();
|
||||
},
|
||||
|
||||
|
|
@ -8309,7 +8327,6 @@ fabric.BaseBrush = fabric.util.createClass(/** @lends fabric.BaseBrush.prototype
|
|||
|
||||
this._reset();
|
||||
this._addPoint(p);
|
||||
|
||||
this.canvas.contextTop.moveTo(p.x, p.y);
|
||||
},
|
||||
|
||||
|
|
@ -8319,9 +8336,10 @@ fabric.BaseBrush = fabric.util.createClass(/** @lends fabric.BaseBrush.prototype
|
|||
*/
|
||||
_addPoint: function(point) {
|
||||
if (this._points.length > 1 && point.eq(this._points[this._points.length - 1])) {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
this._points.push(point);
|
||||
return true;
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
@ -8330,7 +8348,6 @@ fabric.BaseBrush = fabric.util.createClass(/** @lends fabric.BaseBrush.prototype
|
|||
*/
|
||||
_reset: function() {
|
||||
this._points.length = 0;
|
||||
|
||||
this._setBrushStyles();
|
||||
this._setShadow();
|
||||
},
|
||||
|
|
@ -8341,7 +8358,7 @@ fabric.BaseBrush = fabric.util.createClass(/** @lends fabric.BaseBrush.prototype
|
|||
*/
|
||||
_captureDrawingPath: function(pointer) {
|
||||
var pointerPoint = new fabric.Point(pointer.x, pointer.y);
|
||||
this._addPoint(pointerPoint);
|
||||
return this._addPoint(pointerPoint);
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
@ -8371,9 +8388,7 @@ fabric.BaseBrush = fabric.util.createClass(/** @lends fabric.BaseBrush.prototype
|
|||
for (i = 1, len = this._points.length; i < len; i++) {
|
||||
// we pick the point between pi + 1 & pi + 2 as the
|
||||
// end point and p1 as our control point.
|
||||
var midPoint = p1.midPointFrom(p2);
|
||||
ctx.quadraticCurveTo(p1.x, p1.y, midPoint.x, midPoint.y);
|
||||
|
||||
this._drawSegment(ctx, p1, p2);
|
||||
p1 = this._points[i];
|
||||
p2 = this._points[i + 1];
|
||||
}
|
||||
|
|
@ -10106,7 +10121,7 @@ fabric.PatternBrush = fabric.util.createClass(fabric.PencilBrush, /** @lends fab
|
|||
while (i--) {
|
||||
if (this._checkTarget(pointer, objects[i])) {
|
||||
target = objects[i];
|
||||
if (target.type === 'group' && target.subTargetCheck) {
|
||||
if (target.subTargetCheck && target instanceof fabric.Group) {
|
||||
normalizedPointer = this._normalizePointer(target, pointer);
|
||||
subTarget = this._searchPossibleTargets(target._objects, normalizedPointer);
|
||||
subTarget && this.targets.push(subTarget);
|
||||
|
|
@ -11136,7 +11151,7 @@ fabric.PatternBrush = fabric.util.createClass(fabric.PencilBrush, /** @lends fab
|
|||
this.stateful && target.saveState();
|
||||
|
||||
// determine if it's a drag or rotate case
|
||||
if (target._findTargetCorner(this.getPointer(e))) {
|
||||
if (target._findTargetCorner(this.getPointer(e, true))) {
|
||||
this.onBeforeScaleRotate(target);
|
||||
}
|
||||
|
||||
|
|
@ -25043,7 +25058,7 @@ fabric.Image.filters.BaseFilter.fromObject = function(object, callback) {
|
|||
style = obj[p1][p2][property];
|
||||
foundStyle = true;
|
||||
}
|
||||
else if (obj[p1][p2][property] !== style) {
|
||||
else if (obj[p1][p2][property] !== style || !obj[p1][p2].hasOwnProperty(property)) {
|
||||
canBeSwapped = false;
|
||||
}
|
||||
if (obj[p1][p2][property] === this[property]) {
|
||||
|
|
|
|||
2
dist/fabric.min.js
vendored
2
dist/fabric.min.js
vendored
File diff suppressed because one or more lines are too long
|
|
@ -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": "2.0.2",
|
||||
"version": "2.0.3",
|
||||
"author": "Juriy Zaytsev <kangax@gmail.com>",
|
||||
"contributors": [
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue