mirror of
https://github.com/loot/libloot.git
synced 2026-07-27 14:16:01 -07:00
Plugin menu and editor states are now remembered.
This commit is contained in:
@@ -75,6 +75,9 @@ loot-clear-metadata
|
||||
:host(.flip) #editor {
|
||||
display: block;
|
||||
}
|
||||
:host(.fastflip) #wrapper {
|
||||
transition-duration: 1ms;
|
||||
}
|
||||
|
||||
/* Icon styling. */
|
||||
#activeTick {
|
||||
@@ -128,7 +131,7 @@ loot-clear-metadata
|
||||
</core-tooltip>
|
||||
<paper-menu-button>
|
||||
<paper-icon-button icon="more-vert"></paper-icon-button>
|
||||
<paper-dropdown class="dropdown" halign="right">
|
||||
<paper-dropdown class="dropdown" halign="right" opened="{{data.isMenuOpen}}">
|
||||
<div>
|
||||
<paper-item>
|
||||
<paper-checkbox id="showOnlyConflicts" label="Show Only Conflicts" flex></paper-checkbox>
|
||||
@@ -199,6 +202,14 @@ loot-clear-metadata
|
||||
/* Share the data with the editor. */
|
||||
this.shadowRoot.getElementById('editor').data = this.data;
|
||||
if (newValue != undefined) {
|
||||
/* Set the card flip state. */
|
||||
if (this.classList.contains('flip') != this.data.isEditorOpen) {
|
||||
/* Temporarily speed up the flip effect, as otherwise fast
|
||||
scrolling lets the user see the end of it. */
|
||||
this.classList.add('fastflip');
|
||||
this.classList.toggle('flip');
|
||||
}
|
||||
|
||||
/* Also initialise the non-simple-string data. */
|
||||
this.onCrcChange();
|
||||
this.onTagsChange();
|
||||
@@ -250,6 +261,9 @@ loot-clear-metadata
|
||||
},
|
||||
|
||||
onFlipEnd: function(evt) {
|
||||
/* Remove fastflip class if present. */
|
||||
this.classList.remove('fastflip');
|
||||
|
||||
/* Re-calculate tooltip positions, since the flip animation tends to mess with them. */
|
||||
this.shadowRoot.getElementById('activeTick').setPosition();
|
||||
this.shadowRoot.getElementById('dummyPlugin').setPosition();
|
||||
@@ -263,6 +277,8 @@ loot-clear-metadata
|
||||
onShowEditor: function(evt) {
|
||||
var card = evt.target.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentNode.host;
|
||||
|
||||
card.data.isEditorOpen = true;
|
||||
|
||||
/* Fire an open event, so that the UI can enter edit mode. */
|
||||
card.dispatchEvent(new CustomEvent('loot-editor-open', {
|
||||
bubbles: true,
|
||||
|
||||
@@ -353,6 +353,8 @@ loot-editor-close
|
||||
bubbles: true,
|
||||
detail: (evt.target.id == 'accept'),
|
||||
}));
|
||||
|
||||
evt.target.parentElement.parentElement.parentNode.host.data.isEditorOpen = false;
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -41,6 +41,8 @@ function Plugin(obj) {
|
||||
this.isDirty = obj.isDirty;
|
||||
|
||||
this.id = this.name.replace(/\s+/g, '');
|
||||
this.isMenuOpen = false;
|
||||
this.isEditorOpen = false;
|
||||
|
||||
/* Converts between the LOOT metadata object for tags, and their
|
||||
editor row representation. */
|
||||
|
||||
Reference in New Issue
Block a user