mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-08-10 21:19:10 -04:00
Implement Item#getGlobalMatrix(), #globalToLocal() and #localToGlobal()
Closes #270.
This commit is contained in:
parent
696b5f29b9
commit
97fcd6ff38
3 changed files with 23 additions and 16 deletions
src/project
|
@ -59,8 +59,8 @@ var Project = PaperScopeItem.extend(/** @lends Project# */{
|
|||
this.view = view instanceof View ? view : View.create(view);
|
||||
this._selectedItems = {};
|
||||
this._selectedItemCount = 0;
|
||||
// See Item#draw() for an explanation of _drawCount
|
||||
this._drawCount = 0;
|
||||
// See Item#draw() for an explanation of _updateCount
|
||||
this._updateCount = 0;
|
||||
// Change tracking, not in use for now. Activate once required:
|
||||
// this._changes = [];
|
||||
// this._changesById = {};
|
||||
|
@ -421,9 +421,9 @@ var Project = PaperScopeItem.extend(/** @lends Project# */{
|
|||
*/
|
||||
|
||||
draw: function(ctx, matrix, ratio) {
|
||||
// Increase the drawCount before the draw-loop. After that, items that
|
||||
// are visible will have their drawCount set to the new value.
|
||||
this._drawCount++;
|
||||
// Increase the _updateCount before the draw-loop. After that, items
|
||||
// that are visible will have their _updateCount set to the new value.
|
||||
this._updateCount++;
|
||||
ctx.save();
|
||||
matrix.applyToContext(ctx);
|
||||
// Use new Base() so we can use param.extend() to easily override
|
||||
|
@ -450,7 +450,7 @@ var Project = PaperScopeItem.extend(/** @lends Project# */{
|
|||
ctx.strokeWidth = 1;
|
||||
for (var id in this._selectedItems) {
|
||||
var item = this._selectedItems[id];
|
||||
if (item._drawCount === this._drawCount
|
||||
if (item._updateCount === this._updateCount
|
||||
&& (item._drawSelected || item._boundsSelected)) {
|
||||
// Allow definition of selected color on a per item and per
|
||||
// layer level, with a fallback to #009dec
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue