fix(renderer): refactor scrollbar area update logic in G2DTextfieldControlImpl2

This commit is contained in:
extio-de
2026-01-03 14:24:28 +01:00
parent 25d5cbd492
commit e18b535071

View File

@@ -196,6 +196,7 @@ public class G2DTextfieldControlImpl2 extends G2DBaseControlImpl implements Text
}
else if (this.positionModified) {
this.safeInvoke(() -> this.textComponent.setLocation(this.x, this.y));
this.updateScrollBarArea();
this.positionModified = false;
}
@@ -254,10 +255,7 @@ public class G2DTextfieldControlImpl2 extends G2DBaseControlImpl implements Text
this.safeInvoke(() -> ((CustomJTextArea) this.textComponent).setLineWrap(true));
this.safeInvoke(() -> ((CustomJTextArea) this.textComponent).setWrapStyleWord(true));
this.scrollbar.setX(this.x + this.width - 30);
this.scrollbar.setY(this.y);
this.scrollbar.setWidth(30);
this.scrollbar.setHeight(this.height);
this.updateScrollBarArea();
this.scrollbar.setScaleFactor(this.scaleFactor);
this.scrollbar.setEnabled(this.enabled);
this.scrollbar.setVisible(this.visible);
@@ -318,6 +316,13 @@ public class G2DTextfieldControlImpl2 extends G2DBaseControlImpl implements Text
}
}
private void updateScrollBarArea() {
this.scrollbar.setX(this.x + this.width - 30);
this.scrollbar.setY(this.y);
this.scrollbar.setWidth(30);
this.scrollbar.setHeight(this.height);
}
private void onScroll(final double value) {
this.scrollPositionPerc = 1.0 - value;
this.scrollPositionModified = true;