This repository has been archived on 2024-06-03. You can view files and clone it, but cannot push or open issues or pull requests.
2023-07-02 06:52:14 +00:00
|
|
|
package x
|
|
|
|
|
|
|
|
import "git.tebibyte.media/tomo/tomo"
|
|
|
|
import "git.tebibyte.media/tomo/tomo/canvas"
|
|
|
|
|
|
|
|
type canvasBox struct {
|
|
|
|
*box
|
2023-09-08 20:39:58 +00:00
|
|
|
userDrawer canvas.Drawer
|
2023-07-02 06:52:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (backend *Backend) NewCanvasBox () tomo.CanvasBox {
|
2023-08-18 03:20:08 +00:00
|
|
|
this := &canvasBox { }
|
|
|
|
this.box = backend.newBox(this)
|
2023-09-08 20:39:58 +00:00
|
|
|
this.drawer = this
|
2023-08-18 03:20:08 +00:00
|
|
|
return this
|
2023-07-02 06:52:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *canvasBox) Box () tomo.Box {
|
|
|
|
return this
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *canvasBox) SetDrawer (drawer canvas.Drawer) {
|
2023-09-08 20:39:58 +00:00
|
|
|
this.userDrawer = drawer
|
2023-07-02 06:52:14 +00:00
|
|
|
this.invalidateDraw()
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *canvasBox) Invalidate () {
|
|
|
|
this.invalidateDraw()
|
|
|
|
}
|
2023-09-08 20:39:58 +00:00
|
|
|
|
|
|
|
func (this *canvasBox) Draw (can canvas.Canvas) {
|
|
|
|
this.box.Draw(can)
|
|
|
|
this.userDrawer.Draw (
|
2024-05-26 19:18:27 +00:00
|
|
|
can.SubCanvas(this.padding.Apply(this.innerClippingBounds)))
|
2023-09-08 20:39:58 +00:00
|
|
|
}
|