-
Notifications
You must be signed in to change notification settings - Fork 6
/
canvas.go
38 lines (31 loc) · 1.01 KB
/
canvas.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package control
import (
"github.com/goradd/goradd/pkg/html"
"github.com/goradd/goradd/pkg/page"
)
type CanvasI interface {
page.ControlI
}
// Canvas is a Goradd control that is an html canvas control. It currently does not have any primitives
// to draw on the canvas, and is here primarily to create a canvas that you would draw on using JavaScript.
type Canvas struct {
page.Control
}
// NewCanvas creates a Canvas control
func NewCanvas(parent page.ControlI, id string) *Canvas {
p := &Canvas{}
p.Init(p, parent, id)
return p
}
// Init is called by subcontrols. You do not normally need to call it.
func (c *Canvas) Init(self CanvasI, parent page.ControlI, id string) {
c.Control.Init(self, parent, id)
c.Tag = "canvas"
}
// ΩDrawingAttributes is called by the framework to get the temporary attributes that are specifically set by
// this control just before drawing.
func (c *Canvas) ΩDrawingAttributes() *html.Attributes {
a := c.Control.ΩDrawingAttributes()
a.SetDataAttribute("grctl", "canvas")
return a
}