Skip to content
Snippets Groups Projects
Commit 00bc665c authored by Maximilian Giller's avatar Maximilian Giller
Browse files

Added more hooks to make setting up interactions easier

parent e48fe37b
No related branches found
No related tags found
No related merge requests found
...@@ -12,7 +12,6 @@ const DOM_LIST_ITEM = "li"; ...@@ -12,7 +12,6 @@ const DOM_LIST_ITEM = "li";
export class CollectMenu extends ToolMenu { export class CollectMenu extends ToolMenu {
constructor() { constructor() {
super(); super();
this.hooked = false;
} }
hookClearButton() { hookClearButton() {
...@@ -22,12 +21,13 @@ export class CollectMenu extends ToolMenu { ...@@ -22,12 +21,13 @@ export class CollectMenu extends ToolMenu {
}); });
} }
afterSet(key, value) { onMenuShow(initial) {
if (this.hooked === false) { if (initial) {
this.hookClearButton(); this.hookClearButton();
this.hooked = true;
} }
}
afterSet(key, value) {
if (key === COLLECTION_KEY) { if (key === COLLECTION_KEY) {
this.fillDomList(SELECTED_ITEMS_ID, value, this.itemListRenderer); this.fillDomList(SELECTED_ITEMS_ID, value, this.itemListRenderer);
} }
......
...@@ -4,6 +4,7 @@ export default class ToolMenu { ...@@ -4,6 +4,7 @@ export default class ToolMenu {
constructor() { constructor() {
this.warnings = false; this.warnings = false;
this.values = {}; this.values = {};
this.initialShow = true;
} }
loadTool(tool) { loadTool(tool) {
...@@ -12,11 +13,26 @@ export default class ToolMenu { ...@@ -12,11 +13,26 @@ export default class ToolMenu {
} }
show() { show() {
this.onMenuShow(this.initialShow);
this.initialShow = false;
this.getMenu().removeClass("hidden"); this.getMenu().removeClass("hidden");
} }
hide() { hide() {
this.getMenu().addClass("hidden"); this.getMenu().addClass("hidden");
this.onMenuHide();
}
onMenuShow(initial) {
if (this.warnings) {
console.warn('Method "onMenuShow" not implemented.');
}
}
onMenuHide() {
if (this.warnings) {
console.warn('Method "onMenuHide" not implemented.');
}
} }
beforeGet(key) { beforeGet(key) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment