mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-05 20:32:00 -05:00
Only draw selection if global matrix was calculated for the item.
This commit is contained in:
parent
2a3f0646f0
commit
f3524ed0e2
1 changed files with 4 additions and 2 deletions
|
@ -451,17 +451,19 @@ var Project = PaperScopeItem.extend(/** @lends Project# */{
|
||||||
ctx.strokeWidth = 1;
|
ctx.strokeWidth = 1;
|
||||||
for (var id in this._selectedItems) {
|
for (var id in this._selectedItems) {
|
||||||
var item = this._selectedItems[id],
|
var item = this._selectedItems[id],
|
||||||
|
globalMatrix = item._globalMatrix,
|
||||||
size = this._scope.settings.handleSize;
|
size = this._scope.settings.handleSize;
|
||||||
half = size / 2;
|
half = size / 2;
|
||||||
if (item._updateVersion === this._updateVersion
|
if (item._updateVersion === this._updateVersion
|
||||||
&& (item._drawSelected || item._boundsSelected)) {
|
&& (item._drawSelected || item._boundsSelected)
|
||||||
|
&& globalMatrix) {
|
||||||
// Allow definition of selected color on a per item and per
|
// Allow definition of selected color on a per item and per
|
||||||
// layer level, with a fallback to #009dec
|
// layer level, with a fallback to #009dec
|
||||||
var color = item.getSelectedColor()
|
var color = item.getSelectedColor()
|
||||||
|| item.getLayer().getSelectedColor();
|
|| item.getLayer().getSelectedColor();
|
||||||
ctx.strokeStyle = ctx.fillStyle = color
|
ctx.strokeStyle = ctx.fillStyle = color
|
||||||
? color.toCanvasStyle(ctx) : '#009dec';
|
? color.toCanvasStyle(ctx) : '#009dec';
|
||||||
var mx = matrix.clone().concatenate(item._globalMatrix);
|
var mx = matrix.clone().concatenate(globalMatrix);
|
||||||
if (item._drawSelected)
|
if (item._drawSelected)
|
||||||
item._drawSelected(ctx, mx);
|
item._drawSelected(ctx, mx);
|
||||||
if (item._boundsSelected) {
|
if (item._boundsSelected) {
|
||||||
|
|
Loading…
Reference in a new issue