mirror of
https://github.com/Hopiu/fabric.js.git
synced 2026-05-05 04:14:54 +00:00
fixed bug positioning group (#5176)
This commit is contained in:
parent
e09d6dbe72
commit
f62f9f3115
3 changed files with 14 additions and 2 deletions
|
|
@ -99,7 +99,7 @@ fabric.CircleBrush = fabric.util.createClass(fabric.BaseBrush, /** @lends fabric
|
|||
|
||||
circles.push(circle);
|
||||
}
|
||||
var group = new fabric.Group(circles, { originX: 'center', originY: 'center' });
|
||||
var group = new fabric.Group(circles);
|
||||
group.canvas = this.canvas;
|
||||
|
||||
this.canvas.add(group);
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ fabric.SprayBrush = fabric.util.createClass( fabric.BaseBrush, /** @lends fabric
|
|||
rects = this._getOptimizedRects(rects);
|
||||
}
|
||||
|
||||
var group = new fabric.Group(rects, { originX: 'center', originY: 'center' });
|
||||
var group = new fabric.Group(rects);
|
||||
this.shadow && group.setShadow(this.shadow);
|
||||
this.canvas.add(group);
|
||||
this.canvas.fire('path:created', { path: group });
|
||||
|
|
|
|||
|
|
@ -78,6 +78,16 @@
|
|||
|
||||
if (!isAlreadyGrouped) {
|
||||
var center = options && options.centerPoint;
|
||||
// we want to set origins before calculating the bounding box.
|
||||
// so that the topleft can be set with that in mind.
|
||||
// if specific top and left are passed, are overwritten later
|
||||
// with the callSuper('initialize', options)
|
||||
if (options.originX !== undefined) {
|
||||
this.originX = options.originX;
|
||||
}
|
||||
if (options.originY !== undefined) {
|
||||
this.originY = options.originY;
|
||||
}
|
||||
// if coming from svg i do not want to calc bounds.
|
||||
// i assume width and height are passed along options
|
||||
center || this._calcBounds();
|
||||
|
|
@ -495,6 +505,8 @@
|
|||
this.width = width;
|
||||
this.height = height;
|
||||
if (!onlyWidthHeight) {
|
||||
// the bounding box always finds the topleft most corner.
|
||||
// whatever is the group origin, we set up here the left/top position.
|
||||
this.setPositionByOrigin({ x: left, y: top }, 'left', 'top');
|
||||
}
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in a new issue