diff --git a/.gitignore b/.gitignore index 0026861..3c31f54 100644 --- a/.gitignore +++ b/.gitignore @@ -20,3 +20,4 @@ _cgo_export.* _testmain.go *.exe +.vscode diff --git a/README.md b/README.md index 7f2a82c..d3342e2 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,8 @@ func app(context *httpcanvas.Context) { context.LineWidth(5) context.StrokeStyle("#003300") context.Stroke() + + context.ShowFrame() } func main() { diff --git a/examples/circle.go b/examples/circle.go index 296a02b..f27dd6c 100644 --- a/examples/circle.go +++ b/examples/circle.go @@ -20,6 +20,8 @@ func app(context *httpcanvas.Context) { context.LineWidth(5) context.StrokeStyle("#003300") context.Stroke() + + context.ShowFrame() } func main() { diff --git a/examples/line.go b/examples/line.go index 6b63560..2a306c9 100644 --- a/examples/line.go +++ b/examples/line.go @@ -16,6 +16,8 @@ func app(context *httpcanvas.Context) { context.MoveTo(200, 50) context.LineTo(50, 200) context.Stroke() + + context.ShowFrame() } func main() { diff --git a/examples/lines.go b/examples/lines.go index fb5d410..70df205 100644 --- a/examples/lines.go +++ b/examples/lines.go @@ -13,6 +13,8 @@ func app(context *httpcanvas.Context) { context.Stroke() time.Sleep(1 * time.Second) + + context.ShowFrame() } } diff --git a/httpcanvas.go b/httpcanvas.go index 7d6699b..ce55fe2 100644 --- a/httpcanvas.go +++ b/httpcanvas.go @@ -8,7 +8,8 @@ import ( "net/http" "net/url" "strings" - "strconv" + "strconv" + "io/ioutil" ) type mouseMovement struct { @@ -40,161 +41,12 @@ func (c *Canvas) updateUnique() { } func (c *Canvas) renderHtml(w http.ResponseWriter, r *http.Request) error { - container := ` - - -
- - - - - - - - -` - template, err := template.New("basic").Parse(container) + data, err := ioutil.ReadFile("resource/container.html") + container := string( data ) + if err != nil { + return err + } + template, err := template.New("basic").Parse(container) if err != nil { return err } diff --git a/resource/container.html b/resource/container.html new file mode 100644 index 0000000..2057688 --- /dev/null +++ b/resource/container.html @@ -0,0 +1,155 @@ + + + + + + + + + + + + + + \ No newline at end of file