Skip to content

Commit 05da5da

Browse files
committed
move color-hover to coloredit.
1 parent af92b14 commit 05da5da

File tree

2 files changed

+26
-25
lines changed

2 files changed

+26
-25
lines changed

src/widgets/coloredit.js

+26
Original file line numberDiff line numberDiff line change
@@ -453,4 +453,30 @@ export var ImguiColorEditMixin =
453453

454454
return pressed;
455455
},
456+
457+
// Note: only access 3 floats if ImGuiColorEditFlags_NoAlpha flag is set.
458+
colorTooltip(text, col, flags)
459+
{
460+
let g = this.guictx;
461+
this.beginTooltipEx(0, true);
462+
let label = text.split("##")[0];
463+
if (label.length)
464+
{
465+
this.textEx(label);
466+
this.Separator();
467+
}
468+
469+
let sz = new Vec2(g.FontSize * 3 + g.Style.FramePadding.y * 2,
470+
g.FontLineHeight * 3 + g.Style.FramePadding.y * 2);
471+
this.ColorButton("##preview", col, (flags & (ColorEditFlags.InputMask |
472+
ColorEditFlags.NoAlpha |
473+
ColorEditFlags.AlphaPreview |
474+
ColorEditFlags.AlphaPreviewHalf)) |
475+
ColorEditFlags.NoTooltip,
476+
sz);
477+
this.SameLine();
478+
this.Text(col.AsMultiStr(flags & ColorEditFlags.NoAlpha));
479+
this.EndTooltip();
480+
},
481+
456482
};

src/widgets/colorpicker.js

-25
Original file line numberDiff line numberDiff line change
@@ -436,31 +436,6 @@ export var ImguiColorPickerMixin =
436436
this.EndPopup();
437437
},
438438

439-
// Note: only access 3 floats if ImGuiColorEditFlags_NoAlpha flag is set.
440-
colorTooltip(text, col, flags)
441-
{
442-
let g = this.guictx;
443-
this.beginTooltipEx(0, true);
444-
let label = text.split("##")[0];
445-
if (label.length)
446-
{
447-
this.textEx(label);
448-
this.Separator();
449-
}
450-
451-
let sz = new Vec2(g.FontSize * 3 + g.Style.FramePadding.y * 2,
452-
g.FontLineHeight * 3 + g.Style.FramePadding.y * 2);
453-
this.ColorButton("##preview", col, (flags & (ColorEditFlags.InputMask |
454-
ColorEditFlags.NoAlpha |
455-
ColorEditFlags.AlphaPreview |
456-
ColorEditFlags.AlphaPreviewHalf)) |
457-
ColorEditFlags.NoTooltip,
458-
sz);
459-
this.SameLine();
460-
this.Text(col.AsMultiStr(flags & ColorEditFlags.NoAlpha));
461-
this.EndTooltip();
462-
},
463-
464439
// Helper for ColorPicker4()
465440
renderArrowsForVerticalBar(draw_list, pos, half_sz, bar_w)
466441
{

0 commit comments

Comments
 (0)