Skip to content

Commit 76aae82

Browse files
authored
Menu-tooltips-76942 (#53)
* place tooltips in vertical menus to left/right by default tooltips would go above by default and block the previous menu item when the mouse moves on the tooltip itself see #76942 * build artifacts
1 parent 61c7447 commit 76aae82

3 files changed

Lines changed: 20 additions & 2 deletions

File tree

public/cui.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50533,6 +50533,9 @@ CUI.ItemList = (function(superClass) {
5053350533
if (item.hasLeft()) {
5053450534
list_has_button_left = true;
5053550535
}
50536+
if (item.__tooltipOpts && (!item.__tooltipOpts.placement || !item.__tooltipOpts.placements)) {
50537+
item.__tooltipOpts.placements = ["w", "e"];
50538+
}
5053650539
}
5053750540
if (item instanceof CUI.Button || item instanceof CUI.DataField || item instanceof CUI.Label) {
5053850541
_this.__body.append(item);
@@ -50575,6 +50578,12 @@ CUI.ItemList = (function(superClass) {
5057550578
if (menu) {
5057650579
opts.menu_parent = menu;
5057750580
}
50581+
if (!opts.tooltip) {
50582+
opts.tooltip = {};
50583+
}
50584+
if (!opts.tooltip.placement || !opts.tooltip.placements) {
50585+
opts.tooltip.placements = ["w", "e"];
50586+
}
5057850587
btn = new CUI.defaults["class"].Button(opts);
5057950588
listenButtonClick(btn);
5058050589
if (btn.hasLeft()) {

public/cui.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/elements/ItemList/ItemList.coffee

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,9 @@ class CUI.ItemList extends CUI.VerticalLayout
228228
if item.hasLeft()
229229
list_has_button_left = true
230230

231+
if item.__tooltipOpts and (not item.__tooltipOpts.placement or not item.__tooltipOpts.placements)
232+
item.__tooltipOpts.placements = ["w", "e"]
233+
231234
if item instanceof CUI.Button or
232235
item instanceof CUI.DataField or
233236
item instanceof CUI.Label
@@ -262,6 +265,12 @@ class CUI.ItemList extends CUI.VerticalLayout
262265
if menu
263266
opts.menu_parent = menu
264267

268+
if not opts.tooltip
269+
opts.tooltip = {}
270+
271+
if not opts.tooltip.placement or not opts.tooltip.placements
272+
opts.tooltip.placements = ["w", "e"]
273+
265274
btn = new CUI.defaults.class.Button(opts)
266275

267276
listenButtonClick(btn)
@@ -427,4 +436,4 @@ class CUI.ItemList extends CUI.VerticalLayout
427436
CUI.ready =>
428437
CUI.Events.registerEvent
429438
type: "item-list-keydown"
430-
sink: true
439+
sink: true

0 commit comments

Comments
 (0)