From 2225fde6df72952ee6eafdee3f1605989b17c7f9 Mon Sep 17 00:00:00 2001 From: Oliver Hamlet Date: Sat, 5 Mar 2016 11:32:01 +0000 Subject: [PATCH] Remove most plugin card properties Manually set card state instead, because it's more performant and using Polymer's data binding doesn't provide any advantages for the removed properties. --- src/gui/html/elements/loot-plugin-card.html | 62 ++++++--------------- 1 file changed, 18 insertions(+), 44 deletions(-) diff --git a/src/gui/html/elements/loot-plugin-card.html b/src/gui/html/elements/loot-plugin-card.html index da0c4100..c9c7f7cc 100644 --- a/src/gui/html/elements/loot-plugin-card.html +++ b/src/gui/html/elements/loot-plugin-card.html @@ -44,8 +44,7 @@ loot-clear-metadata :host(.highlight) #wrapper { outline: 4px solid var(--loot-accent-color); } - :host([is-search-result]) #front, - :host([is-search-result]) #editor { + :host(.search-result) #wrapper > * { box-shadow: inset 4px 0 var(--loot-primary-color); } #front { @@ -80,7 +79,8 @@ loot-clear-metadata #activeTick { color: green; } - :host(:not([is-active])) #activeTick { + #activeTick[hidden] { + display: initial; visibility: hidden; } @@ -147,13 +147,13 @@ loot-clear-metadata - + Master File - - Empty Plugin - + + Empty Plugin + Loads Archive - + Has User Metadata @@ -203,36 +203,6 @@ loot-clear-metadata notify: true, observer: '_dataChanged', }, - isActive: { - type: Boolean, - value: false, - reflectToAttribute: true, - }, - isMaster: { - type: Boolean, - value: false, - reflectToAttribute: true, - }, - isEmpty: { - type: Boolean, - value: false, - reflectToAttribute: true, - }, - loadsArchive: { - type: Boolean, - value: false, - reflectToAttribute: true, - }, - hasUserEdits: { - type: Boolean, - value: false, - reflectToAttribute: true, - }, - isSearchResult: { - type: Boolean, - value: false, - reflectToAttribute: true, - }, }, attached() { @@ -277,11 +247,14 @@ loot-clear-metadata /* Initialise the card content data. */ this.updateContent(); - /* Also set highlight if the conflict filter is active. */ - this.classList.toggle('highlight', newValue.isConflictFilterChecked); + /* Set icons' visibility */ + this.$.activeTick.hidden = !this.data.isActive; + this.$.isMaster.hidden = !this.data.isMaster; + this.$.isEmpty.hidden = !this.data.isEmpty; + this.$.loadsArchive.hidden = !this.data.loadsArchive; - /* Set highlight if the plugin is a search result. */ - this.classList.toggle('search-result', newValue.isSearchResult); + /* Also set highlight if the conflict filter is active. */ + this.classList.toggle('highlight', this.data.isConflictFilterChecked); } }, @@ -330,8 +303,9 @@ loot-clear-metadata this._setTagsContent(cardContent.tags); this._setMessagesContent(cardContent.messages); - this.hasUserEdits = this.data.hasUserEdits; - this.isSearchResult = this.data.isSearchResult; + this.$.hasUserEdits.hidden = !this.data.hasUserEdits; + /* Set highlight if the plugin is a search result. */ + this.classList.toggle('search-result', this.data.isSearchResult); /* Update the conflict filter toggle state. */ this.$.showOnlyConflicts.checked = this.data.isConflictFilterChecked;