[Modern] Correctly account for full thumb width in slider positioning

This commit is contained in:
Jordan Eldredge 2021-09-10 17:33:23 -07:00
parent 7996a2de47
commit f4ca71cd8d

View file

@ -179,11 +179,10 @@ export default class Slider extends GuiObj {
const bitmap = UI_ROOT.getBitmap(this._thumb);
// TODO: What if the orientation has changed?
if (this._vertical) {
const top =
this._position * (this.getheight() - bitmap.getHeight() / 2);
const top = this._position * (this.getheight() - bitmap.getHeight());
this._thumbDiv.style.top = px(top);
} else {
const left = this._position * (this.getwidth() - bitmap.getWidth() / 2);
const left = this._position * (this.getwidth() - bitmap.getWidth());
this._thumbDiv.style.left = px(left);
}
}