fix so you can't click item that opens submenu

pull/29/head
brianharvey 2016-12-26 20:55:43 -08:00
rodzic ac9fad3af2
commit 51aa5db3b0
1 zmienionych plików z 18 dodań i 9 usunięć

Wyświetl plik

@ -9479,8 +9479,10 @@ MenuItemMorph.prototype.mouseDownLeft = function (pos) {
if (this.isListItem()) { if (this.isListItem()) {
this.parent.unselectAllItems(); this.parent.unselectAllItems();
this.escalateEvent('mouseDownLeft', pos); this.escalateEvent('mouseDownLeft', pos);
} this.image = this.pressImage;
this.image = this.pressImage; } else if (!(this.doubleClickAction instanceof MenuMorph)) {
this.image = this.pressImage;
}
this.changed(); this.changed();
}; };
@ -9491,17 +9493,24 @@ MenuItemMorph.prototype.mouseMove = function () {
}; };
MenuItemMorph.prototype.mouseClickLeft = function () { MenuItemMorph.prototype.mouseClickLeft = function () {
if (!this.isListItem()) { if (!(this.doubleClickAction instanceof MenuMorph)) {
var topmenu = this.parent; if (!this.isListItem()) {
while (topmenu.parent instanceof MenuMorph) { var topmenu = this.parent;
topmenu = topmenu.parent; while (topmenu.parent instanceof MenuMorph) {
topmenu = topmenu.parent;
}
topmenu.destroy();
this.root().activeMenu = null;
} }
topmenu.destroy(); this.trigger();
this.root().activeMenu = null;
} }
this.trigger();
}; };
MenuItemMorph.prototype.mouseDoubleClick = function () {
if (!(this.doubleClickAction instanceof MenuMorph))
this.triggerDoubleClick();
}
MenuItemMorph.prototype.isListItem = function () { MenuItemMorph.prototype.isListItem = function () {
if (this.parent) { if (this.parent) {
return this.parent.isListContents; return this.parent.isListContents;