I have found what looks like an inconsistency with stroke width. Between the next 3 images, only 1 line of code was changed.
First, black stroke of 2 thickness. Second, yellow stroke of 2 thickness. Third, yellow stroke of 1 thickness.
To me, it looks like the black stroke is drawing with a width of 1 regardless of thickness. The code will draw white when hovered, and it looks thicker and matches the yellow thickness. When I patch the thickness to be 1, the white thickness matches the 1st and 3rd image.
So, like if the color is black (rgba: (0,0,0,1)) then the stroke width is off?
For the first change, I un-commented: if (!hovered) col = vec4(1, 1, 0, 1);
For the second change, I changed dl.AddRect(itemAdjRect, col, 0, 2) to dl.AddRect(itemAdjRect, col, 0, 1)
1
2
3
code
void DrawMappingOverlay(UI::Texture@ tex, vec2 imgTL, LmMappingCache@ mapping) {
auto size = vec2(1024);
auto dl = UI::GetWindowDrawList();
auto fg = UI::GetForegroundDrawList();
dl.AddImage(tex, imgTL, size);
if (mapping is null) return;
auto nbHovered = 0;
for (uint i = 0; i < mapping.objs.Length; i++) {
auto item = mapping.objs[i];
// auto pos = item.size;
auto itemAdjRect = vec4(imgTL - vec2(1.25), vec2(1.25)) + item.imgRect;
bool hovered = MathX::Within(UI::GetMousePos(), itemAdjRect);
auto c = hovered ? 1.0 : 0.;
auto col = vec4(c, c, c, 1);
if (!hovered) col = vec4(1, 1, 0, 1);
// thickness 2 for first 2 images and thickness 1 for final image.
dl.AddRect(itemAdjRect, col, 0, 1);
if (hovered) {
auto yOffset = 34.0 * nbHovered;
auto textTL = imgTL + vec2(1024 + 20, yOffset);
auto rectTL = textTL - vec2(4);
auto textSize = Draw::MeasureString(item.fidFileName, g_BigFont, 26);
auto rectSize = textSize + vec2(8);
fg.AddRectFilled(vec4(rectTL, rectSize), vec4(.1, .1, .1, .9));
DrawList_AddTextWithStroke(fg, imgTL + vec2(1024 + 20, yOffset), vec4(1, 1, 0, 1), vec4(0), item.fidFileName, g_BigFont, 26);
nbHovered++;
}
}
}
I have found what looks like an inconsistency with stroke width. Between the next 3 images, only 1 line of code was changed.
First, black stroke of 2 thickness. Second, yellow stroke of 2 thickness. Third, yellow stroke of 1 thickness.
To me, it looks like the black stroke is drawing with a width of 1 regardless of thickness. The code will draw white when hovered, and it looks thicker and matches the yellow thickness. When I patch the thickness to be 1, the white thickness matches the 1st and 3rd image.
So, like if the color is black (rgba: (0,0,0,1)) then the stroke width is off?
For the first change, I un-commented:
if (!hovered) col = vec4(1, 1, 0, 1);
For the second change, I changed
dl.AddRect(itemAdjRect, col, 0, 2)
todl.AddRect(itemAdjRect, col, 0, 1)
1
2
3
code