Fixed wierd inconsistency with element core

This commit is contained in:
Sasha Koshka
2023-01-31 16:18:10 -05:00
parent 6d6a0c59a1
commit 2f9504b1e4
13 changed files with 47 additions and 45 deletions

View File

@@ -257,7 +257,7 @@ func (element *TextBox) runOnChange () {
func (element *TextBox) scrollToCursor () {
if !element.core.HasImage() { return }
bounds := element.core.Bounds().Inset(theme.Padding())
bounds := element.Bounds().Inset(theme.Padding())
bounds.Max.X -= element.valueDrawer.Em().Round()
cursorPosition := element.valueDrawer.PositionOf(element.cursor)
cursorPosition.X -= element.scroll
@@ -272,7 +272,7 @@ func (element *TextBox) scrollToCursor () {
}
func (element *TextBox) draw () {
bounds := element.core.Bounds()
bounds := element.Bounds()
// FIXME: take index into account
pattern, inset := theme.InputPattern(theme.PatternState {
@@ -280,7 +280,7 @@ func (element *TextBox) draw () {
Disabled: !element.Enabled(),
Focused: element.Focused(),
})
artist.FillRectangle(element.core, pattern, bounds)
artist.FillRectangle(element, pattern, bounds)
if len(element.text) == 0 && !element.Focused() {
// draw placeholder
@@ -294,7 +294,7 @@ func (element *TextBox) draw () {
Disabled: true,
})
element.placeholderDrawer.Draw (
element.core,
element,
foreground,
offset.Sub(textBounds.Min))
} else {
@@ -309,7 +309,7 @@ func (element *TextBox) draw () {
Disabled: !element.Enabled(),
})
element.valueDrawer.Draw (
element.core,
element,
foreground,
offset.Sub(textBounds.Min))
@@ -321,7 +321,7 @@ func (element *TextBox) draw () {
Case: textBoxCase,
})
artist.Line (
element.core,
element,
foreground, 1,
cursorPosition.Add(offset),
image.Pt (