Various optimizations around Project#view.

This commit is contained in:
Jürg Lehni 2016-01-14 01:44:05 +01:00
parent 00a7588a3a
commit 0743f1b7b8
5 changed files with 11 additions and 5 deletions

View file

@ -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;
},
/**

View file

@ -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();
}
});

View file

@ -1189,7 +1189,7 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
* @bean
*/
getView: function() {
return this._project.getView();
return this._project._view;
},
/**

View file

@ -302,7 +302,7 @@ var Style = Base.extend(new function() {
* @type View
*/
getView: function() {
return this._project.getView();
return this._project._view;
},
// Overrides

View file

@ -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);