Positioning of bars does not work correctly
Kaszaq opened this issue ยท 2 comments
Hello,
It is not possible to set a bar LEFT point to be relative to a center of UIParent and grow the icons to the right starting from left. If the offset is set to zero, the bar is not aligned to the center but offset to the left a little bit which I think might be the root use case causing other issues with bars alignment.
And here how it roughly looks like [the yellow line is a middle of the screen]
See how it looks without icons:
My guess is that this seems to be cause by the fact that "Point of the anchor" is not working as designed. It should always be used to anchor both the text/"draggin bar" and place from which the icons grow.
Even if I manually adjust the position of the "text" when it is unlocked, the position of icons gets broken after lock&reload as then the offset seem to directly impact icons and no longer the text.
Unlocked and adjusted manually with mouse:
unlocked with test:
after locking and reloading [note icons are no longer near the center]:
Thanks for help.
I found two solutions. Changed / new lines marked with asterix [*]
The "moving anchor box" will not have it size changed.
Will not be as pretty as the text if long will go outside of the box.
These two lines have to be commented out/removed.
if self.disabled or self.settings.locked or #self.active > 0 then
self.anchor:Hide()
else
* --local width = self.anchor.text:GetWidth() + 29
* --self.anchor:SetSize(width, 30)
self.anchor:Show()
end
end
Update the anchor points.
Modify lines around 900 [changing the position]
self.settings.position.relativeTo = "UIParent"
self.settings.position.relativePoint = "CENTER"
self.settings.position.xOfs = 0
self.settings.position.yOfs = 0
OmniBar_LoadPosition(self)
end
*function OmniBar_resetAnchor(self, point)
* self.anchor:ClearAllPoints()
* self.anchor:SetPoint(point, self, point,0,0);
*end
function OmniBar_LoadPosition(self)
self:ClearAllPoints()
if self.settings.position then
local point = self.settings.position.point or "CENTER"
* OmniBar_resetAnchor(self, point);
local relativeTo = self.settings.position.relativeTo or "UIParent"
With that the size remains correct of the anchor so the text does not go outside. Now when anchoring to the left point and setting in settings value of zero, the anchor correctly does move it left side to that point with correct offset. However as this is something that was there for some time, implementing this change will move users omnibars by few pixels. That being said I think that the second approach is the correct one as it basically makes the setup works as users expect it to.
Let me know what you think. Cheers
Hey @jordonwow , any chances you can please apply this fix? Everything that is needed is to add lines around 900 [new lines marked with *]
self.settings.position.relativeTo = "UIParent"
self.settings.position.relativePoint = "CENTER"
self.settings.position.xOfs = 0
self.settings.position.yOfs = 0
OmniBar_LoadPosition(self)
end
*function OmniBar_resetAnchor(self, point)
* self.anchor:ClearAllPoints()
* self.anchor:SetPoint(point, self, point,0,0);
*end
function OmniBar_LoadPosition(self)
self:ClearAllPoints()
if self.settings.position then
local point = self.settings.position.point or "CENTER"
* OmniBar_resetAnchor(self, point);
local relativeTo = self.settings.position.relativeTo or "UIParent"
Thanks