mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-01 02:38:43 -05:00
Streamline code for #1427
This commit is contained in:
parent
e3c298d3f4
commit
4ba406bfe3
3 changed files with 24 additions and 14 deletions
|
@ -10,6 +10,7 @@
|
||||||
|
|
||||||
- Fix drawing with compound-paths as clip-items (#1361).
|
- Fix drawing with compound-paths as clip-items (#1361).
|
||||||
- Fix drawing of path selection with small handle size (#1327).
|
- Fix drawing of path selection with small handle size (#1327).
|
||||||
|
- Do not ignore `Group#clipItem.matrix` in `Group#internalBounds` (#1427).
|
||||||
- Correctly calculate bounds with nested empty items (#1467).
|
- Correctly calculate bounds with nested empty items (#1467).
|
||||||
- Fix color change propagation on groups (#1152).
|
- Fix color change propagation on groups (#1152).
|
||||||
- SVG Export: Fix error when `Item#matrix` is not invertible (#1580).
|
- SVG Export: Fix error when `Item#matrix` is not invertible (#1580).
|
||||||
|
|
|
@ -171,8 +171,7 @@ var Group = Item.extend(/** @lends Group# */{
|
||||||
_getBounds: function _getBounds(matrix, options) {
|
_getBounds: function _getBounds(matrix, options) {
|
||||||
var clipItem = this._getClipItem();
|
var clipItem = this._getClipItem();
|
||||||
return clipItem
|
return clipItem
|
||||||
? clipItem._getCachedBounds(
|
? clipItem._getCachedBounds(clipItem._matrix.prepended(matrix),
|
||||||
matrix && matrix.appended(clipItem._matrix) || clipItem._matrix,
|
|
||||||
Base.set({}, options, { stroke: false }))
|
Base.set({}, options, { stroke: false }))
|
||||||
: _getBounds.base.call(this, matrix, options);
|
: _getBounds.base.call(this, matrix, options);
|
||||||
},
|
},
|
||||||
|
|
|
@ -167,15 +167,25 @@ test('Group#isEmpty(recursively)', function() {
|
||||||
equals(true, group.isEmpty(true));
|
equals(true, group.isEmpty(true));
|
||||||
});
|
});
|
||||||
|
|
||||||
test('group.getInternalBounds() with clip item without matrix applied', function() {
|
test(
|
||||||
|
'group.internalBounds with clip item without clip.applyMatrix = false',
|
||||||
|
function() {
|
||||||
var point = new Point(100, 100);
|
var point = new Point(100, 100);
|
||||||
var translation = new Point(100, 100);
|
var translation = new Point(100, 100);
|
||||||
var item = new Path.Circle({ center: point, radius: 50, fillColor: 'orange' });
|
var item = new Path.Circle({
|
||||||
var clip = new Path.Rectangle({ from: point.subtract(translation), to: point.add(translation) });
|
center: point,
|
||||||
|
radius: 50,
|
||||||
|
fillColor: 'orange'
|
||||||
|
});
|
||||||
|
var clip = new Path.Rectangle({
|
||||||
|
from: point.subtract(translation),
|
||||||
|
to: point.add(translation)
|
||||||
|
});
|
||||||
clip.applyMatrix = false;
|
clip.applyMatrix = false;
|
||||||
clip.translate(translation);
|
clip.translate(translation);
|
||||||
var group = new Group(clip, item);
|
var group = new Group(clip, item);
|
||||||
group.clipped = true;
|
group.clipped = true;
|
||||||
|
var expected = new Rectangle(point, point.add(translation.multiply(2)));
|
||||||
equals(group.getInternalBounds(), new Rectangle(point, point.add(translation.multiply(2))));
|
equals(group.internalBounds, expected);
|
||||||
});
|
}
|
||||||
|
);
|
||||||
|
|
Loading…
Reference in a new issue