Double-click sidebar plugin item to open its editor.

Closes #255. The effect is slightly ruined by core-list bugs...
This commit is contained in:
Oliver Hamlet
2014-12-23 17:00:35 +00:00
parent 898753f858
commit f7ce535030
3 changed files with 12 additions and 2 deletions
+6 -1
View File
@@ -286,7 +286,12 @@ loot-clear-metadata
},
onShowEditor: function(evt) {
var card = evt.target.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentNode.host;
var card;
if (this.tagName == 'LOOT-PLUGIN-CARD') {
card = this;
} else {
card = this.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentNode.host;
}
/* If the editor hasn't already been opened, its data is not yet set, so do that now. */
if (!card.data.isEditorOpen && !card.data.editor) {
+5
View File
@@ -991,6 +991,10 @@ function handleSidebarClick(evt) {
document.getElementById('main').lastElementChild.scrollToItem(evt.target.getAttribute('data-index'));
/* However, the scroll bar that the plugin card list uses is for the whole main content area, so the position is offset by the heights of the summary and general messages cards. Adjust to compensate. */
document.getElementById('main').scrollTop += document.getElementById('main').lastElementChild.offsetTop;
if (evt.type == 'dblclick') {
document.getElementById(evt.target.getAttribute('data-id')).onShowEditor();
}
}
}
function handleQuit(evt) {
@@ -1047,6 +1051,7 @@ function setupEventHandlers() {
document.getElementById('drawerToggle').addEventListener('click', toggleDrawer, false);
document.getElementById('cardsNav').addEventListener('click', handleSidebarClick, false);
document.getElementById('cardsNav').addEventListener('dblclick', handleSidebarClick, false);
}
function initVars() {
loot.query('getVersion').then(function(result){
+1 -1
View File
@@ -59,7 +59,7 @@
</paper-item>
<core-list flex>
<template>
<loot-plugin-item data-bsa?="{{model.loadsBSA}}" data="{{model}}" data-index="{{index}}">
<loot-plugin-item data-id="{{model.id}}" data-bsa?="{{model.loadsBSA}}" data="{{model}}" data-index="{{index}}">
{{model.name}}
</loot-plugin-item>
</template>