Skip to content

Commit 70262e0

Browse files
committed
gui/mass-remove.toolbar: extra panel to support changes in anchor sides
1 parent 3d5f180 commit 70262e0

File tree

1 file changed

+55
-50
lines changed

1 file changed

+55
-50
lines changed

gui/mass-remove.lua

Lines changed: 55 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -451,52 +451,57 @@ function MassRemoveToolbarOverlay:init()
451451

452452
self:addviews{
453453
widgets.Panel{
454-
view_id='tooltip',
455-
frame={t=0, r=0, w=MR_WIDTH, h=MR_TOOLTIP_HEIGHT},
456-
frame_style=gui.FRAME_PANEL,
457-
frame_background=gui.CLEAR_PEN,
458-
frame_inset={l=1, r=1},
459-
visible=function() return self.subviews.icon:getMousePos() end,
460-
subviews={
461-
widgets.Label{
462-
text={
463-
'Open mass removal', NEWLINE,
464-
'interface.', NEWLINE,
465-
NEWLINE,
466-
{text='Hotkey: ', pen=COLOR_GRAY}, {key='CUSTOM_M'},
467-
},
468-
},
469-
},
470-
},
471-
widgets.Panel{
472-
view_id='icon',
473-
frame={b=0, r=MR_WIDTH-MR_BUTTON_WIDTH, w=MR_BUTTON_WIDTH, h=tb.SECONDARY_TOOLBAR_HEIGHT},
474-
subviews={
475-
widgets.Label{
476-
text=widgets.makeButtonLabelText{
477-
chars=button_chars,
478-
pens=COLOR_GRAY,
479-
tileset=toolbar_textures,
480-
tileset_offset=1,
481-
tileset_stride=8,
454+
view_id='tt_and_icon',
455+
frame={ r=0, t=0, w=MR_WIDTH, h=MR_HEIGHT },
456+
subviews={
457+
widgets.Panel{
458+
frame={t=0, l=0, w=MR_WIDTH, h=MR_TOOLTIP_HEIGHT},
459+
frame_style=gui.FRAME_PANEL,
460+
frame_background=gui.CLEAR_PEN,
461+
frame_inset={l=1, r=1},
462+
visible=function() return self.subviews.icon:getMousePos() end,
463+
subviews={
464+
widgets.Label{
465+
text={
466+
'Open mass removal', NEWLINE,
467+
'interface.', NEWLINE,
468+
NEWLINE,
469+
{text='Hotkey: ', pen=COLOR_GRAY}, {key='CUSTOM_M'},
470+
},
471+
},
482472
},
483-
on_click=launch_mass_remove,
484-
visible=function () return not self.subviews.icon:getMousePos() end,
485473
},
486-
widgets.Label{
487-
text=widgets.makeButtonLabelText{
488-
chars=button_chars,
489-
pens={
490-
{COLOR_WHITE, COLOR_WHITE, COLOR_WHITE, COLOR_WHITE},
491-
{COLOR_WHITE, COLOR_GRAY, COLOR_GRAY, COLOR_WHITE},
492-
{COLOR_WHITE, COLOR_WHITE, COLOR_WHITE, COLOR_WHITE},
474+
widgets.Panel{
475+
view_id='icon',
476+
frame={b=0, l=0, w=MR_BUTTON_WIDTH, h=tb.SECONDARY_TOOLBAR_HEIGHT},
477+
subviews={
478+
widgets.Label{
479+
text=widgets.makeButtonLabelText{
480+
chars=button_chars,
481+
pens=COLOR_GRAY,
482+
tileset=toolbar_textures,
483+
tileset_offset=1,
484+
tileset_stride=8,
485+
},
486+
on_click=launch_mass_remove,
487+
visible=function () return not self.subviews.icon:getMousePos() end,
488+
},
489+
widgets.Label{
490+
text=widgets.makeButtonLabelText{
491+
chars=button_chars,
492+
pens={
493+
{COLOR_WHITE, COLOR_WHITE, COLOR_WHITE, COLOR_WHITE},
494+
{COLOR_WHITE, COLOR_GRAY, COLOR_GRAY, COLOR_WHITE},
495+
{COLOR_WHITE, COLOR_WHITE, COLOR_WHITE, COLOR_WHITE},
496+
},
497+
tileset=toolbar_textures,
498+
tileset_offset=5,
499+
tileset_stride=8,
500+
},
501+
on_click=launch_mass_remove,
502+
visible=function() return self.subviews.icon:getMousePos() end,
493503
},
494-
tileset=toolbar_textures,
495-
tileset_offset=5,
496-
tileset_stride=8,
497504
},
498-
on_click=launch_mass_remove,
499-
visible=function() return self.subviews.icon:getMousePos() end,
500505
},
501506
},
502507
},
@@ -508,22 +513,22 @@ function MassRemoveToolbarOverlay:preUpdateLayout(parent_rect)
508513
local offsets = mass_remove_button_offsets(parent_rect)
509514
if self.frame.l then
510515
extra_width = offsets.l - MR_MIN_OFFSETS.l
511-
self.subviews.tooltip.frame.l = nil
512-
self.subviews.tooltip.frame.r = 0
513-
self.subviews.icon.frame.l = nil
514-
self.subviews.icon.frame.r = MR_WIDTH-MR_BUTTON_WIDTH
516+
self.subviews.tt_and_icon.frame.l = nil
517+
self.subviews.tt_and_icon.frame.r = 0
515518
else
516519
extra_width = offsets.r - MR_MIN_OFFSETS.r
517-
self.subviews.tooltip.frame.r = nil
518-
self.subviews.tooltip.frame.l = 0
519-
self.subviews.icon.frame.r = nil
520-
self.subviews.icon.frame.l = 0
520+
self.subviews.tt_and_icon.frame.l = 0
521+
self.subviews.tt_and_icon.frame.r = nil
521522
end
522523
local extra_height
523524
if self.frame.b then
524525
extra_height = offsets.b - MR_MIN_OFFSETS.b
526+
self.subviews.tt_and_icon.frame.t = 0
527+
self.subviews.tt_and_icon.frame.b = nil
525528
else
526529
extra_height = offsets.t - MR_MIN_OFFSETS.t
530+
self.subviews.tt_and_icon.frame.t = nil
531+
self.subviews.tt_and_icon.frame.b = 0
527532
end
528533
self.frame.w = MR_WIDTH + extra_width
529534
self.frame.h = MR_HEIGHT + extra_height

0 commit comments

Comments
 (0)