rework slideup menus to use shared components

This commit is contained in:
Luke Pulverenti 2016-07-17 22:55:07 -04:00
parent 7323e865f2
commit 63efbfc838
28 changed files with 521 additions and 392 deletions

View file

@ -7,7 +7,7 @@
while (!elem.getAttribute(name)) {
elem = elem.parentNode;
if (!elem) {
if (!elem || !elem.getAttribute) {
return null;
}
}
@ -62,6 +62,26 @@
};
}
ItemsContainerProtoType.enableHoverMenu = function (enabled) {
var current = this.hoverMenu;
if (!enabled && current) {
current.destroy();
this.hoverMenu = null;
return;
}
if (current) {
return;
}
var self = this;
require(['itemHoverMenu'], function (ItemHoverMenu) {
self.hoverMenu = new ItemHoverMenu(self);
});
};
ItemsContainerProtoType.attachedCallback = function () {
this.addEventListener('click', onClick);
@ -73,6 +93,10 @@
this.addEventListener('contextmenu', onContextMenu);
}
if (layoutManager.desktop) {
this.enableHoverMenu(true);
}
itemShortcuts.on(this, getShortcutOptions());
};