Combine internal packages into one internal package

This commit is contained in:
Sasha Koshka 2024-09-10 18:29:04 -04:00
parent 6f2a31cd60
commit 039e0da646
4 changed files with 8 additions and 8 deletions

View File

@ -1,4 +1,4 @@
package color package internal
import "fmt" import "fmt"
import "image/color" import "image/color"

View File

@ -1,4 +1,4 @@
package history package internal
import "time" import "time"

View File

@ -8,7 +8,7 @@ import "git.tebibyte.media/tomo/tomo/input"
import "git.tebibyte.media/tomo/tomo/event" import "git.tebibyte.media/tomo/tomo/event"
import "git.tebibyte.media/tomo/tomo/canvas" import "git.tebibyte.media/tomo/tomo/canvas"
import "git.tebibyte.media/tomo/objects/layouts" import "git.tebibyte.media/tomo/objects/layouts"
import icolor "git.tebibyte.media/tomo/objects/internal/color" import "git.tebibyte.media/tomo/objects/internal"
var _ tomo.Object = new(Swatch) var _ tomo.Object = new(Swatch)
@ -117,7 +117,7 @@ func (this *Swatch) Choose () {
updateHexInput := func () { updateHexInput := func () {
nrgba := color.NRGBAModel.Convert(colorPicker.Value()).(color.NRGBA) nrgba := color.NRGBAModel.Convert(colorPicker.Value()).(color.NRGBA)
hexInput.SetValue(icolor.FormatNRGBA(nrgba)) hexInput.SetValue(internal.FormatNRGBA(nrgba))
} }
updateHexInput() updateHexInput()
commit := func () { commit := func () {
@ -130,7 +130,7 @@ func (this *Swatch) Choose () {
}) })
hexInput.OnConfirm(commit) hexInput.OnConfirm(commit)
hexInput.OnValueChange(func () { hexInput.OnValueChange(func () {
nrgba := icolor.ParseNRGBA(hexInput.Value()) nrgba := internal.ParseNRGBA(hexInput.Value())
this.userSetValue(nrgba) this.userSetValue(nrgba)
colorPicker.SetValue(nrgba) colorPicker.SetValue(nrgba)
}) })

View File

@ -6,7 +6,7 @@ import "git.tebibyte.media/tomo/tomo"
import "git.tebibyte.media/tomo/tomo/text" import "git.tebibyte.media/tomo/tomo/text"
import "git.tebibyte.media/tomo/tomo/input" import "git.tebibyte.media/tomo/tomo/input"
import "git.tebibyte.media/tomo/tomo/event" import "git.tebibyte.media/tomo/tomo/event"
import "git.tebibyte.media/tomo/objects/internal/history" import "git.tebibyte.media/tomo/objects/internal"
const textInputHistoryMaximum = 64 const textInputHistoryMaximum = 64
const textInputHistoryMaxAge = time.Second / 4 const textInputHistoryMaxAge = time.Second / 4
@ -22,7 +22,7 @@ type TextInput struct {
box tomo.TextBox box tomo.TextBox
text []rune text []rune
multiline bool multiline bool
history *history.History[textHistoryItem] history *internal.History[textHistoryItem]
on struct { on struct {
dotChange event.FuncBroadcaster dotChange event.FuncBroadcaster
valueChange event.FuncBroadcaster valueChange event.FuncBroadcaster
@ -35,7 +35,7 @@ func newTextInput (text string, multiline bool) *TextInput {
box: tomo.NewTextBox(), box: tomo.NewTextBox(),
text: []rune(text), text: []rune(text),
multiline: multiline, multiline: multiline,
history: history.NewHistory[textHistoryItem] ( history: internal.NewHistory[textHistoryItem] (
textHistoryItem { text: text }, textHistoryItem { text: text },
textInputHistoryMaximum), textInputHistoryMaximum),
} }