mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-03 19:45:44 -05:00
Various optimizations around Project#view.
This commit is contained in:
parent
00a7588a3a
commit
0743f1b7b8
5 changed files with 11 additions and 5 deletions
|
@ -155,7 +155,8 @@ var PaperScope = Base.extend(/** @lends PaperScope# */{
|
|||
* @type View
|
||||
*/
|
||||
getView: function() {
|
||||
return this.project && this.project.getView();
|
||||
var project = this.project;
|
||||
return project && project._view;
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
@ -58,5 +58,9 @@ var PaperScopeItem = Base.extend(Emitter, /** @lends PaperScopeItem# */{
|
|||
this._scope[this._reference] = null;
|
||||
this._scope = null;
|
||||
return true;
|
||||
},
|
||||
|
||||
getView: function() {
|
||||
return this._scope.getView();
|
||||
}
|
||||
});
|
||||
|
|
|
@ -1189,7 +1189,7 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
|
|||
* @bean
|
||||
*/
|
||||
getView: function() {
|
||||
return this._project.getView();
|
||||
return this._project._view;
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
@ -302,7 +302,7 @@ var Style = Base.extend(new function() {
|
|||
* @type View
|
||||
*/
|
||||
getView: function() {
|
||||
return this._project.getView();
|
||||
return this._project._view;
|
||||
},
|
||||
|
||||
// Overrides
|
||||
|
|
|
@ -132,8 +132,9 @@ var View = Base.extend(Emitter, /** @lends View# */{
|
|||
View._views.splice(View._views.indexOf(this), 1);
|
||||
delete View._viewsById[this._id];
|
||||
// Unlink from project
|
||||
if (this._project._view === this)
|
||||
this._project._view = null;
|
||||
var project = this._project;
|
||||
if (project._view === this)
|
||||
project._view = null;
|
||||
/*#*/ if (__options.environment == 'browser') {
|
||||
// Uninstall event handlers again for this view.
|
||||
DomEvent.remove(this._element, this._viewEvents);
|
||||
|
|
Loading…
Reference in a new issue