From ed1763e6e208deabb0794cf613868b6ab11fb69f Mon Sep 17 00:00:00 2001 From: Fen Dweller Date: Tue, 23 Jun 2020 09:50:11 -0400 Subject: [PATCH] Add a currentView property to entities --- macrovision.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/macrovision.js b/macrovision.js index 513bec7c..c6dd916d 100644 --- a/macrovision.js +++ b/macrovision.js @@ -707,6 +707,16 @@ function makeEntity(info, views, sizes) { ) }); + Object.defineProperty( + this, + "currentView", + { + get: function() { + return entity.views[entity.view]; + } + } + ) + delete this.init; return this; } @@ -1050,10 +1060,10 @@ function configViewOptions(entity, view) { e.stopPropagation(); }) - if (entity.views[view].units[key]) { - select.value = entity.views[view].units[key]; + if (entity.currentView.units[key]) { + select.value = entity.currentView.units[key]; } else { - entity.views[view].units[key] = select.value; + entity.currentView.units[key] = select.value; } select.setAttribute("oldUnit", select.value);