Upgrade to new version of typeset
This commit is contained in:
parent
7fc2b1cd87
commit
d9cf931903
2
go.mod
2
go.mod
@ -4,7 +4,7 @@ go 1.20
|
|||||||
|
|
||||||
require (
|
require (
|
||||||
git.tebibyte.media/tomo/tomo v0.29.0
|
git.tebibyte.media/tomo/tomo v0.29.0
|
||||||
git.tebibyte.media/tomo/typeset v0.5.2
|
git.tebibyte.media/tomo/typeset v0.7.0
|
||||||
git.tebibyte.media/tomo/xgbkb v1.0.1
|
git.tebibyte.media/tomo/xgbkb v1.0.1
|
||||||
github.com/jezek/xgb v1.1.0
|
github.com/jezek/xgb v1.1.0
|
||||||
github.com/jezek/xgbutil v0.0.0-20230603163917-04188eb39cf0
|
github.com/jezek/xgbutil v0.0.0-20230603163917-04188eb39cf0
|
||||||
|
4
go.sum
4
go.sum
@ -1,8 +1,8 @@
|
|||||||
git.tebibyte.media/sashakoshka/xgbkb v1.0.0/go.mod h1:pNcE6TRO93vHd6q42SdwLSTTj25L0Yzggz7yLe0JV6Q=
|
git.tebibyte.media/sashakoshka/xgbkb v1.0.0/go.mod h1:pNcE6TRO93vHd6q42SdwLSTTj25L0Yzggz7yLe0JV6Q=
|
||||||
git.tebibyte.media/tomo/tomo v0.29.0 h1:uvdPaEQYcWH965y85SjIKwhLklnTbs+x6MRwLfdRvfo=
|
git.tebibyte.media/tomo/tomo v0.29.0 h1:uvdPaEQYcWH965y85SjIKwhLklnTbs+x6MRwLfdRvfo=
|
||||||
git.tebibyte.media/tomo/tomo v0.29.0/go.mod h1:C9EzepS9wjkTJjnZaPBh22YvVPyA4hbBAJVU20Rdmps=
|
git.tebibyte.media/tomo/tomo v0.29.0/go.mod h1:C9EzepS9wjkTJjnZaPBh22YvVPyA4hbBAJVU20Rdmps=
|
||||||
git.tebibyte.media/tomo/typeset v0.5.2 h1:qHxN62/VDnrAouOuzxLmLleQNwAebshrfVYvtoOnAG4=
|
git.tebibyte.media/tomo/typeset v0.7.0 h1:JFpEuGmN6R2XSCvkINYxpH0AyYUqqs+dZYr6OSd91y0=
|
||||||
git.tebibyte.media/tomo/typeset v0.5.2/go.mod h1:PwDpSdBF3l/EzoIsa2ME7QffVVajnTHZN6l3MHEGe1g=
|
git.tebibyte.media/tomo/typeset v0.7.0/go.mod h1:PwDpSdBF3l/EzoIsa2ME7QffVVajnTHZN6l3MHEGe1g=
|
||||||
git.tebibyte.media/tomo/xgbkb v1.0.1 h1:b3HDUopjdQp1MZrb5Vpil4bOtk3NnNXtfQW27Blw2kE=
|
git.tebibyte.media/tomo/xgbkb v1.0.1 h1:b3HDUopjdQp1MZrb5Vpil4bOtk3NnNXtfQW27Blw2kE=
|
||||||
git.tebibyte.media/tomo/xgbkb v1.0.1/go.mod h1:P5Du0yo5hUsojchW08t+Mds0XPIJXwMi733ZfklzjRw=
|
git.tebibyte.media/tomo/xgbkb v1.0.1/go.mod h1:P5Du0yo5hUsojchW08t+Mds0XPIJXwMi733ZfklzjRw=
|
||||||
github.com/BurntSushi/freetype-go v0.0.0-20160129220410-b763ddbfe298 h1:1qlsVAQJXZHsaM8b6OLVo6muQUQd4CwkH/D3fnnbHXA=
|
github.com/BurntSushi/freetype-go v0.0.0-20160129220410-b763ddbfe298 h1:1qlsVAQJXZHsaM8b6OLVo6muQUQd4CwkH/D3fnnbHXA=
|
||||||
|
17
textbox.go
17
textbox.go
@ -23,6 +23,7 @@ type textBox struct {
|
|||||||
face font.Face
|
face font.Face
|
||||||
wrap bool
|
wrap bool
|
||||||
hAlign tomo.Align
|
hAlign tomo.Align
|
||||||
|
vAlign tomo.Align
|
||||||
|
|
||||||
selectable bool
|
selectable bool
|
||||||
selecting bool
|
selecting bool
|
||||||
@ -129,16 +130,10 @@ func (this *textBox) OnDotChange (callback func ()) event.Cookie {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (this *textBox) SetAlign (x, y tomo.Align) {
|
func (this *textBox) SetAlign (x, y tomo.Align) {
|
||||||
if this.hAlign == x { return }
|
if this.hAlign == x && this.vAlign == y { return }
|
||||||
this.hAlign = x
|
this.hAlign = x
|
||||||
|
this.vAlign = y
|
||||||
switch x {
|
this.drawer.SetAlign(typeset.Align(x), typeset.Align(y))
|
||||||
case tomo.AlignStart: this.drawer.SetAlign(typeset.AlignLeft)
|
|
||||||
case tomo.AlignMiddle: this.drawer.SetAlign(typeset.AlignCenter)
|
|
||||||
case tomo.AlignEnd: this.drawer.SetAlign(typeset.AlignRight)
|
|
||||||
case tomo.AlignEven: this.drawer.SetAlign(typeset.AlignJustify)
|
|
||||||
}
|
|
||||||
|
|
||||||
this.invalidateDraw()
|
this.invalidateDraw()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -293,8 +288,8 @@ func (this *textBox) doLayout () {
|
|||||||
previousContentBounds := this.contentBounds
|
previousContentBounds := this.contentBounds
|
||||||
|
|
||||||
innerBounds := this.InnerBounds()
|
innerBounds := this.InnerBounds()
|
||||||
this.drawer.SetMaxWidth(innerBounds.Dx())
|
this.drawer.SetWidth(innerBounds.Dx())
|
||||||
this.drawer.SetMaxHeight(innerBounds.Dy())
|
this.drawer.SetHeight(innerBounds.Dy())
|
||||||
|
|
||||||
this.contentBounds = this.normalizedLayoutBoundsSpace()
|
this.contentBounds = this.normalizedLayoutBoundsSpace()
|
||||||
this.constrainScroll()
|
this.constrainScroll()
|
||||||
|
Reference in New Issue
Block a user