mirror of
https://github.com/Hopiu/fabric.js.git
synced 2026-03-27 19:20:25 +00:00
drawCorners -> drawControls, for consistency. Remove unused hasCorners and use hasControls instead of hideCorners. Version 1.0.12
This commit is contained in:
parent
80469a23eb
commit
9be89b2f2f
14 changed files with 65 additions and 65 deletions
|
|
@ -1,6 +1,6 @@
|
|||
/*! Fabric.js Copyright 2008-2013, Printio (Juriy Zaytsev, Maxim Chernyak) */
|
||||
|
||||
var fabric = fabric || { version: "1.0.11" };
|
||||
var fabric = fabric || { version: "1.0.12" };
|
||||
|
||||
if (typeof exports !== 'undefined') {
|
||||
exports.fabric = fabric;
|
||||
|
|
|
|||
56
dist/all.js
vendored
56
dist/all.js
vendored
|
|
@ -1,7 +1,7 @@
|
|||
/* build: `node build.js modules=ALL exclude=gestures` */
|
||||
/*! Fabric.js Copyright 2008-2013, Printio (Juriy Zaytsev, Maxim Chernyak) */
|
||||
|
||||
var fabric = fabric || { version: "1.0.11" };
|
||||
var fabric = fabric || { version: "1.0.12" };
|
||||
|
||||
if (typeof exports !== 'undefined') {
|
||||
exports.fabric = fabric;
|
||||
|
|
@ -5744,7 +5744,7 @@ fabric.Shadow = fabric.util.createClass(/** @scope fabric.Shadow.prototype */ {
|
|||
clipTo: null,
|
||||
|
||||
/**
|
||||
* Indicates whether object controls (borders/corners) are rendered above overlay image
|
||||
* Indicates whether object controls (borders/controls) are rendered above overlay image
|
||||
* @property
|
||||
* @type Boolean
|
||||
*/
|
||||
|
|
@ -6056,11 +6056,11 @@ fabric.Shadow = fabric.util.createClass(/** @scope fabric.Shadow.prototype */ {
|
|||
if (!object) return;
|
||||
|
||||
if (this.controlsAboveOverlay) {
|
||||
var hasBorders = object.hasBorders, hasCorners = object.hasCorners;
|
||||
object.hasBorders = object.hasCorners = false;
|
||||
var hasBorders = object.hasBorders, hasControls = object.hasControls;
|
||||
object.hasBorders = object.hasControls = false;
|
||||
object.render(ctx);
|
||||
object.hasBorders = hasBorders;
|
||||
object.hasCorners = hasCorners;
|
||||
object.hasControls = hasControls;
|
||||
}
|
||||
else {
|
||||
object.render(ctx);
|
||||
|
|
@ -6288,7 +6288,7 @@ fabric.Shadow = fabric.util.createClass(/** @scope fabric.Shadow.prototype */ {
|
|||
}
|
||||
|
||||
// delegate rendering to group selection if one exists
|
||||
// used for drawing selection borders/corners
|
||||
// used for drawing selection borders/controls
|
||||
var activeGroup = this.getActiveGroup();
|
||||
if (activeGroup) {
|
||||
activeGroup.render(ctx);
|
||||
|
|
@ -6304,7 +6304,7 @@ fabric.Shadow = fabric.util.createClass(/** @scope fabric.Shadow.prototype */ {
|
|||
},
|
||||
|
||||
/**
|
||||
* Draws objects' controls (borders/corners)
|
||||
* Draws objects' controls (borders/controls)
|
||||
* @method drawControls
|
||||
* @param {Object} ctx context to render controls on
|
||||
*/
|
||||
|
|
@ -6313,7 +6313,7 @@ fabric.Shadow = fabric.util.createClass(/** @scope fabric.Shadow.prototype */ {
|
|||
if (activeGroup) {
|
||||
ctx.save();
|
||||
fabric.Group.prototype.transform.call(activeGroup, ctx);
|
||||
activeGroup.drawBorders(ctx).drawCorners(ctx);
|
||||
activeGroup.drawBorders(ctx).drawControls(ctx);
|
||||
ctx.restore();
|
||||
}
|
||||
else {
|
||||
|
|
@ -6322,7 +6322,7 @@ fabric.Shadow = fabric.util.createClass(/** @scope fabric.Shadow.prototype */ {
|
|||
|
||||
ctx.save();
|
||||
fabric.Object.prototype.transform.call(this._objects[i], ctx);
|
||||
this._objects[i].drawBorders(ctx).drawCorners(ctx);
|
||||
this._objects[i].drawBorders(ctx).drawControls(ctx);
|
||||
ctx.restore();
|
||||
|
||||
this.lastRenderedObjectWithControlsAboveOverlay = this._objects[i];
|
||||
|
|
@ -6374,7 +6374,7 @@ fabric.Shadow = fabric.util.createClass(/** @scope fabric.Shadow.prototype */ {
|
|||
|
||||
if (activeGroup) {
|
||||
// not removing group due to complications with restoring it with correct state afterwords
|
||||
this._tempRemoveBordersCornersFromGroup(activeGroup);
|
||||
this._tempRemoveBordersControlsFromGroup(activeGroup);
|
||||
}
|
||||
else if (activeObject && this.deactivateAll) {
|
||||
this.deactivateAll();
|
||||
|
|
@ -6393,7 +6393,7 @@ fabric.Shadow = fabric.util.createClass(/** @scope fabric.Shadow.prototype */ {
|
|||
this.setWidth(origWidth).setHeight(origHeight);
|
||||
|
||||
if (activeGroup) {
|
||||
this._restoreBordersCornersOnGroup(activeGroup);
|
||||
this._restoreBordersControlsOnGroup(activeGroup);
|
||||
}
|
||||
else if (activeObject && this.setActiveObject) {
|
||||
this.setActiveObject(activeObject);
|
||||
|
|
@ -6407,13 +6407,13 @@ fabric.Shadow = fabric.util.createClass(/** @scope fabric.Shadow.prototype */ {
|
|||
|
||||
/**
|
||||
* @private
|
||||
* @method _tempRemoveBordersCornersFromGroup
|
||||
* @method _tempRemoveBordersControlsFromGroup
|
||||
*/
|
||||
_tempRemoveBordersCornersFromGroup: function(group) {
|
||||
group.origHideCorners = group.hideCorners;
|
||||
_tempRemoveBordersControlsFromGroup: function(group) {
|
||||
group.origHasControls = group.hasControls;
|
||||
group.origBorderColor = group.borderColor;
|
||||
|
||||
group.hideCorners = true;
|
||||
group.hasControls = true;
|
||||
group.borderColor = 'rgba(0,0,0,0)';
|
||||
|
||||
group.forEachObject(function(o) {
|
||||
|
|
@ -6424,10 +6424,10 @@ fabric.Shadow = fabric.util.createClass(/** @scope fabric.Shadow.prototype */ {
|
|||
|
||||
/**
|
||||
* @private
|
||||
* @method _restoreBordersCornersOnGroup
|
||||
* @method _restoreBordersControlsOnGroup
|
||||
*/
|
||||
_restoreBordersCornersOnGroup: function(group) {
|
||||
group.hideCorners = group.origHideCorners;
|
||||
_restoreBordersControlsOnGroup: function(group) {
|
||||
group.hideControls = group.origHideControls;
|
||||
group.borderColor = group.origBorderColor;
|
||||
|
||||
group.forEachObject(function(o) {
|
||||
|
|
@ -9761,7 +9761,7 @@ fabric.util.object.extend(fabric.StaticCanvas.prototype, /** @scope fabric.Stati
|
|||
|
||||
if (this.active && !noTransform) {
|
||||
this.drawBorders(ctx);
|
||||
this.hideCorners || this.drawCorners(ctx);
|
||||
this.drawControls(ctx);
|
||||
}
|
||||
ctx.restore();
|
||||
},
|
||||
|
|
@ -11065,12 +11065,12 @@ fabric.util.object.extend(fabric.StaticCanvas.prototype, /** @scope fabric.Stati
|
|||
* Draws corners of an object's bounding box.
|
||||
* Requires public properties: width, height, scaleX, scaleY
|
||||
* Requires public options: cornerSize, padding
|
||||
* @method drawCorners
|
||||
* @method drawControls
|
||||
* @param {CanvasRenderingContext2D} ctx Context to draw on
|
||||
* @return {fabric.Object} thisArg
|
||||
* @chainable
|
||||
*/
|
||||
drawCorners: function(ctx) {
|
||||
drawControls: function(ctx) {
|
||||
if (!this.hasControls) return;
|
||||
|
||||
var size = this.cornerSize,
|
||||
|
|
@ -13035,7 +13035,7 @@ fabric.util.object.extend(fabric.StaticCanvas.prototype, /** @scope fabric.Stati
|
|||
}
|
||||
if (!noTransform && this.active) {
|
||||
this.drawBorders(ctx);
|
||||
this.hideCorners || this.drawCorners(ctx);
|
||||
this.drawControls(ctx);
|
||||
}
|
||||
ctx.restore();
|
||||
},
|
||||
|
|
@ -13342,7 +13342,7 @@ fabric.util.object.extend(fabric.StaticCanvas.prototype, /** @scope fabric.Stati
|
|||
|
||||
if (this.active) {
|
||||
this.drawBorders(ctx);
|
||||
this.hideCorners || this.drawCorners(ctx);
|
||||
this.drawControls(ctx);
|
||||
}
|
||||
ctx.restore();
|
||||
},
|
||||
|
|
@ -13593,7 +13593,7 @@ fabric.util.object.extend(fabric.StaticCanvas.prototype, /** @scope fabric.Stati
|
|||
object.setCoords();
|
||||
|
||||
// do not display corners of objects enclosed in a group
|
||||
object.hideCorners = true;
|
||||
object.hasControls = false;
|
||||
}, this);
|
||||
},
|
||||
|
||||
|
|
@ -13759,7 +13759,7 @@ fabric.util.object.extend(fabric.StaticCanvas.prototype, /** @scope fabric.Stati
|
|||
|
||||
if (!noTransform && this.active) {
|
||||
this.drawBorders(ctx);
|
||||
this.hideCorners || this.drawCorners(ctx);
|
||||
this.drawControls(ctx);
|
||||
}
|
||||
ctx.restore();
|
||||
this.setCoords();
|
||||
|
|
@ -13823,7 +13823,7 @@ fabric.util.object.extend(fabric.StaticCanvas.prototype, /** @scope fabric.Stati
|
|||
object.set('scaleY', object.get('scaleY') * this.get('scaleY'));
|
||||
|
||||
object.setCoords();
|
||||
object.hideCorners = false;
|
||||
object.hasControls = true;
|
||||
object.setActive(false);
|
||||
object.setCoords();
|
||||
|
||||
|
|
@ -14168,7 +14168,7 @@ fabric.util.object.extend(fabric.StaticCanvas.prototype, /** @scope fabric.Stati
|
|||
|
||||
if (this.active && !noTransform) {
|
||||
this.drawBorders(ctx);
|
||||
this.hideCorners || this.drawCorners(ctx);
|
||||
this.drawControls(ctx);
|
||||
}
|
||||
ctx.restore();
|
||||
},
|
||||
|
|
@ -16024,7 +16024,7 @@ fabric.Image.filters.Pixelate.fromObject = function(object) {
|
|||
this._render(ctx);
|
||||
if (!noTransform && this.active) {
|
||||
this.drawBorders(ctx);
|
||||
this.hideCorners || this.drawCorners(ctx);
|
||||
this.drawControls(ctx);
|
||||
}
|
||||
ctx.restore();
|
||||
},
|
||||
|
|
|
|||
10
dist/all.min.js
vendored
10
dist/all.min.js
vendored
File diff suppressed because one or more lines are too long
BIN
dist/all.min.js.gz
vendored
BIN
dist/all.min.js.gz
vendored
Binary file not shown.
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "fabric",
|
||||
"description": "Object model for HTML5 canvas, and SVG-to-canvas parser. Backed by jsdom and node-canvas.",
|
||||
"version": "1.0.11",
|
||||
"version": "1.0.12",
|
||||
"author": "Juriy Zaytsev <kangax@gmail.com>",
|
||||
"keywords": ["canvas", "graphic", "graphics", "SVG", "node-canvas", "parser", "HTML5", "object model"],
|
||||
"repository": "git://github.com/kangax/fabric.js",
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@
|
|||
object.setCoords();
|
||||
|
||||
// do not display corners of objects enclosed in a group
|
||||
object.hideCorners = true;
|
||||
object.hasControls = false;
|
||||
}, this);
|
||||
},
|
||||
|
||||
|
|
@ -257,7 +257,7 @@
|
|||
|
||||
if (!noTransform && this.active) {
|
||||
this.drawBorders(ctx);
|
||||
this.hideCorners || this.drawCorners(ctx);
|
||||
this.drawControls(ctx);
|
||||
}
|
||||
ctx.restore();
|
||||
this.setCoords();
|
||||
|
|
@ -321,7 +321,7 @@
|
|||
object.set('scaleY', object.get('scaleY') * this.get('scaleY'));
|
||||
|
||||
object.setCoords();
|
||||
object.hideCorners = false;
|
||||
object.hasControls = true;
|
||||
object.setActive(false);
|
||||
object.setCoords();
|
||||
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@
|
|||
|
||||
if (this.active && !noTransform) {
|
||||
this.drawBorders(ctx);
|
||||
this.hideCorners || this.drawCorners(ctx);
|
||||
this.drawControls(ctx);
|
||||
}
|
||||
ctx.restore();
|
||||
},
|
||||
|
|
|
|||
|
|
@ -663,7 +663,7 @@
|
|||
|
||||
if (this.active && !noTransform) {
|
||||
this.drawBorders(ctx);
|
||||
this.hideCorners || this.drawCorners(ctx);
|
||||
this.drawControls(ctx);
|
||||
}
|
||||
ctx.restore();
|
||||
},
|
||||
|
|
|
|||
|
|
@ -383,12 +383,12 @@
|
|||
* Draws corners of an object's bounding box.
|
||||
* Requires public properties: width, height, scaleX, scaleY
|
||||
* Requires public options: cornerSize, padding
|
||||
* @method drawCorners
|
||||
* @method drawControls
|
||||
* @param {CanvasRenderingContext2D} ctx Context to draw on
|
||||
* @return {fabric.Object} thisArg
|
||||
* @chainable
|
||||
*/
|
||||
drawCorners: function(ctx) {
|
||||
drawControls: function(ctx) {
|
||||
if (!this.hasControls) return;
|
||||
|
||||
var size = this.cornerSize,
|
||||
|
|
|
|||
|
|
@ -571,7 +571,7 @@
|
|||
}
|
||||
if (!noTransform && this.active) {
|
||||
this.drawBorders(ctx);
|
||||
this.hideCorners || this.drawCorners(ctx);
|
||||
this.drawControls(ctx);
|
||||
}
|
||||
ctx.restore();
|
||||
},
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@
|
|||
|
||||
if (this.active) {
|
||||
this.drawBorders(ctx);
|
||||
this.hideCorners || this.drawCorners(ctx);
|
||||
this.drawControls(ctx);
|
||||
}
|
||||
ctx.restore();
|
||||
},
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@
|
|||
clipTo: null,
|
||||
|
||||
/**
|
||||
* Indicates whether object controls (borders/corners) are rendered above overlay image
|
||||
* Indicates whether object controls (borders/controls) are rendered above overlay image
|
||||
* @property
|
||||
* @type Boolean
|
||||
*/
|
||||
|
|
@ -429,11 +429,11 @@
|
|||
if (!object) return;
|
||||
|
||||
if (this.controlsAboveOverlay) {
|
||||
var hasBorders = object.hasBorders, hasCorners = object.hasCorners;
|
||||
object.hasBorders = object.hasCorners = false;
|
||||
var hasBorders = object.hasBorders, hasControls = object.hasControls;
|
||||
object.hasBorders = object.hasControls = false;
|
||||
object.render(ctx);
|
||||
object.hasBorders = hasBorders;
|
||||
object.hasCorners = hasCorners;
|
||||
object.hasControls = hasControls;
|
||||
}
|
||||
else {
|
||||
object.render(ctx);
|
||||
|
|
@ -661,7 +661,7 @@
|
|||
}
|
||||
|
||||
// delegate rendering to group selection if one exists
|
||||
// used for drawing selection borders/corners
|
||||
// used for drawing selection borders/controls
|
||||
var activeGroup = this.getActiveGroup();
|
||||
if (activeGroup) {
|
||||
activeGroup.render(ctx);
|
||||
|
|
@ -677,7 +677,7 @@
|
|||
},
|
||||
|
||||
/**
|
||||
* Draws objects' controls (borders/corners)
|
||||
* Draws objects' controls (borders/controls)
|
||||
* @method drawControls
|
||||
* @param {Object} ctx context to render controls on
|
||||
*/
|
||||
|
|
@ -686,7 +686,7 @@
|
|||
if (activeGroup) {
|
||||
ctx.save();
|
||||
fabric.Group.prototype.transform.call(activeGroup, ctx);
|
||||
activeGroup.drawBorders(ctx).drawCorners(ctx);
|
||||
activeGroup.drawBorders(ctx).drawControls(ctx);
|
||||
ctx.restore();
|
||||
}
|
||||
else {
|
||||
|
|
@ -695,7 +695,7 @@
|
|||
|
||||
ctx.save();
|
||||
fabric.Object.prototype.transform.call(this._objects[i], ctx);
|
||||
this._objects[i].drawBorders(ctx).drawCorners(ctx);
|
||||
this._objects[i].drawBorders(ctx).drawControls(ctx);
|
||||
ctx.restore();
|
||||
|
||||
this.lastRenderedObjectWithControlsAboveOverlay = this._objects[i];
|
||||
|
|
@ -747,7 +747,7 @@
|
|||
|
||||
if (activeGroup) {
|
||||
// not removing group due to complications with restoring it with correct state afterwords
|
||||
this._tempRemoveBordersCornersFromGroup(activeGroup);
|
||||
this._tempRemoveBordersControlsFromGroup(activeGroup);
|
||||
}
|
||||
else if (activeObject && this.deactivateAll) {
|
||||
this.deactivateAll();
|
||||
|
|
@ -766,7 +766,7 @@
|
|||
this.setWidth(origWidth).setHeight(origHeight);
|
||||
|
||||
if (activeGroup) {
|
||||
this._restoreBordersCornersOnGroup(activeGroup);
|
||||
this._restoreBordersControlsOnGroup(activeGroup);
|
||||
}
|
||||
else if (activeObject && this.setActiveObject) {
|
||||
this.setActiveObject(activeObject);
|
||||
|
|
@ -780,13 +780,13 @@
|
|||
|
||||
/**
|
||||
* @private
|
||||
* @method _tempRemoveBordersCornersFromGroup
|
||||
* @method _tempRemoveBordersControlsFromGroup
|
||||
*/
|
||||
_tempRemoveBordersCornersFromGroup: function(group) {
|
||||
group.origHideCorners = group.hideCorners;
|
||||
_tempRemoveBordersControlsFromGroup: function(group) {
|
||||
group.origHasControls = group.hasControls;
|
||||
group.origBorderColor = group.borderColor;
|
||||
|
||||
group.hideCorners = true;
|
||||
group.hasControls = true;
|
||||
group.borderColor = 'rgba(0,0,0,0)';
|
||||
|
||||
group.forEachObject(function(o) {
|
||||
|
|
@ -797,10 +797,10 @@
|
|||
|
||||
/**
|
||||
* @private
|
||||
* @method _restoreBordersCornersOnGroup
|
||||
* @method _restoreBordersControlsOnGroup
|
||||
*/
|
||||
_restoreBordersCornersOnGroup: function(group) {
|
||||
group.hideCorners = group.origHideCorners;
|
||||
_restoreBordersControlsOnGroup: function(group) {
|
||||
group.hideControls = group.origHideControls;
|
||||
group.borderColor = group.origBorderColor;
|
||||
|
||||
group.forEachObject(function(o) {
|
||||
|
|
|
|||
|
|
@ -643,7 +643,7 @@
|
|||
this._render(ctx);
|
||||
if (!noTransform && this.active) {
|
||||
this.drawBorders(ctx);
|
||||
this.hideCorners || this.drawCorners(ctx);
|
||||
this.drawControls(ctx);
|
||||
}
|
||||
ctx.restore();
|
||||
},
|
||||
|
|
|
|||
|
|
@ -392,7 +392,7 @@
|
|||
equal(cObj.drawBorders(dummyContext), cObj, 'chainable');
|
||||
});
|
||||
|
||||
test('drawCorners', function() {
|
||||
test('drawControls', function() {
|
||||
var cObj = new fabric.Object(), canvas = fabric.document.createElement('canvas');
|
||||
|
||||
//let excanvas kick in for IE8 and lower
|
||||
|
|
@ -400,8 +400,8 @@
|
|||
G_vmlCanvasManager.initElement(canvas)
|
||||
}
|
||||
var dummyContext = canvas.getContext('2d');
|
||||
ok(typeof cObj.drawCorners == 'function');
|
||||
equal(cObj.drawCorners(dummyContext), cObj, 'chainable');
|
||||
ok(typeof cObj.drawControls == 'function');
|
||||
equal(cObj.drawControls(dummyContext), cObj, 'chainable');
|
||||
});
|
||||
|
||||
test('clone', function() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue