Update docs to use GopherJS (#54)
3
_docs/example.tmpl.html
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
{{comment .License}}
|
||||||
|
<script src="{{.Example.Name}}.js"></script>
|
85
_docs/gen.go
@ -28,11 +28,6 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
|
||||||
outputPath = "public/index.html"
|
|
||||||
templatePath = "index.tmpl.html"
|
|
||||||
)
|
|
||||||
|
|
||||||
var license = ""
|
var license = ""
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
@ -110,10 +105,23 @@ func versions() string {
|
|||||||
return fmt.Sprintf("v%s (dev: v%s)", stableVersion, devVersion)
|
return fmt.Sprintf("v%s (dev: v%s)", stableVersion, devVersion)
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
var examples = []example{
|
||||||
f, err := os.Create(outputPath)
|
{Name: "blocks"},
|
||||||
|
{Name: "hue"},
|
||||||
|
{Name: "mosaic"},
|
||||||
|
{Name: "perspective"},
|
||||||
|
{Name: "rotate"},
|
||||||
|
}
|
||||||
|
|
||||||
|
func clear() error {
|
||||||
|
// TODO: favicon?
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func outputMain() error {
|
||||||
|
f, err := os.Create("public/index.html")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
return err
|
||||||
}
|
}
|
||||||
defer f.Close()
|
defer f.Close()
|
||||||
|
|
||||||
@ -121,26 +129,71 @@ func main() {
|
|||||||
"comment": comment,
|
"comment": comment,
|
||||||
"safeHTML": safeHTML,
|
"safeHTML": safeHTML,
|
||||||
}
|
}
|
||||||
|
const templatePath = "index.tmpl.html"
|
||||||
name := filepath.Base(templatePath)
|
name := filepath.Base(templatePath)
|
||||||
t, err := template.New(name).Funcs(funcs).ParseFiles(templatePath)
|
t, err := template.New(name).Funcs(funcs).ParseFiles(templatePath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
examples := []example{
|
|
||||||
{Name: "blocks"},
|
|
||||||
{Name: "hue"},
|
|
||||||
{Name: "mosaic"},
|
|
||||||
{Name: "perspective"},
|
|
||||||
{Name: "rotate"},
|
|
||||||
}
|
|
||||||
data := map[string]interface{}{
|
data := map[string]interface{}{
|
||||||
"License": license,
|
"License": license,
|
||||||
"StableVersion": stableVersion,
|
"StableVersion": stableVersion,
|
||||||
"DevVersion": devVersion,
|
"DevVersion": devVersion,
|
||||||
"Examples": examples,
|
"Examples": examples,
|
||||||
}
|
}
|
||||||
|
return t.Funcs(funcs).Execute(f, data)
|
||||||
|
}
|
||||||
|
|
||||||
|
func outputExample(e *example) error {
|
||||||
|
const dir = "public/example"
|
||||||
|
if err := os.MkdirAll(dir, 0755); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
f, err := os.Create(filepath.Join(dir, e.Name+".html"))
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer f.Close()
|
||||||
|
|
||||||
|
funcs := template.FuncMap{
|
||||||
|
"comment": comment,
|
||||||
|
"safeHTML": safeHTML,
|
||||||
|
}
|
||||||
|
const templatePath = "example.tmpl.html"
|
||||||
|
name := filepath.Base(templatePath)
|
||||||
|
t, err := template.New(name).Funcs(funcs).ParseFiles(templatePath)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
data := map[string]interface{}{
|
||||||
|
"License": license,
|
||||||
|
"Example": e,
|
||||||
|
}
|
||||||
if err := t.Funcs(funcs).Execute(f, data); err != nil {
|
if err := t.Funcs(funcs).Execute(f, data); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
out := filepath.Join(dir, e.Name+".js")
|
||||||
|
path := "github.com/hajimehoshi/ebiten/example/" + e.Name
|
||||||
|
if err := exec.Command("gopherjs", "build", "-m", "-o", out, path).Run(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
if err := clear(); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
if err := outputMain(); err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
for _, e := range examples {
|
||||||
|
if err := outputExample(&e); err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,3 +15,4 @@
|
|||||||
package docs
|
package docs
|
||||||
|
|
||||||
//go:generate go run gen.go
|
//go:generate go run gen.go
|
||||||
|
//go:generate cp -r ../example/images ./public/example/
|
||||||
|
@ -19,6 +19,12 @@ table.examples td.code pre {
|
|||||||
height: 240px;
|
height: 240px;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
}
|
}
|
||||||
|
table.examples iframe {
|
||||||
|
border-color: #999;
|
||||||
|
border-style: solid;
|
||||||
|
border-width: 1px;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
<h1>Ebiten (海老天)</h1>
|
<h1>Ebiten (海老天)</h1>
|
||||||
<p>v{{.StableVersion}}</p>
|
<p>v{{.StableVersion}}</p>
|
||||||
@ -49,7 +55,11 @@ table.examples td.code pre {
|
|||||||
<td class="code"><pre><code>// <b>{{.Name}}</b>
|
<td class="code"><pre><code>// <b>{{.Name}}</b>
|
||||||
|
|
||||||
{{.Source}}</code></pre></td>
|
{{.Source}}</code></pre></td>
|
||||||
<td><img src="{{.Name}}.gif" width="{{.Width}}" height="{{.Height}}"></td>
|
{{if ne .Name "blocks"}}
|
||||||
|
<td><iframe src="example/{{.Name}}.html" width="{{.Width}}" height="{{.Height}}"></iframe></td>
|
||||||
|
{{else}}
|
||||||
|
<td>(TODO: Implement link)</td>
|
||||||
|
{{end}}
|
||||||
</tr>
|
</tr>
|
||||||
{{end}}
|
{{end}}
|
||||||
</table>
|
</table>
|
||||||
|
Before Width: | Height: | Size: 424 KiB |
18
_docs/public/example/blocks.html
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<!--
|
||||||
|
Copyright 2015 Hajime Hoshi
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
|
||||||
|
-->
|
||||||
|
<script src="blocks.js"></script>
|
61
_docs/public/example/blocks.js
Normal file
1
_docs/public/example/blocks.js.map
Normal file
18
_docs/public/example/hue.html
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<!--
|
||||||
|
Copyright 2015 Hajime Hoshi
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
|
||||||
|
-->
|
||||||
|
<script src="hue.js"></script>
|
57
_docs/public/example/hue.js
Normal file
1
_docs/public/example/hue.js.map
Normal file
BIN
_docs/public/example/images/blocks/background.png
Normal file
After Width: | Height: | Size: 138 B |
BIN
_docs/public/example/images/blocks/blocks.png
Normal file
After Width: | Height: | Size: 165 B |
BIN
_docs/public/example/images/blocks/ebiten.png
Normal file
After Width: | Height: | Size: 2.1 KiB |
BIN
_docs/public/example/images/blocks/font.png
Normal file
After Width: | Height: | Size: 1008 B |
BIN
_docs/public/example/images/ebiten.png
Normal file
After Width: | Height: | Size: 3.3 KiB |
BIN
_docs/public/example/images/gophers.jpg
Normal file
After Width: | Height: | Size: 16 KiB |
41
_docs/public/example/images/license.md
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
# License
|
||||||
|
|
||||||
|
## blocks/font.png
|
||||||
|
|
||||||
|
```
|
||||||
|
9031 Font ReadMe
|
||||||
|
|
||||||
|
Terms of Use and Disclaimer
|
||||||
|
|
||||||
|
All 9031 fonts are free of charge to use for personal or commercial purposes, e.g. printed papers, t-shirts, logos, images for website, merchandise or anything featuring these fonts.
|
||||||
|
|
||||||
|
OpenType font files are licensed for your personal desktop use only. No part of these files may be re-distributed, sold, renamed, converted, or made available for download on any web site without permission of author.
|
||||||
|
|
||||||
|
Author give no warranty in relation to these fonts, and you use them at your own risk. By using or installing these fonts, you agree to be bound by the terms of this agreement. Author will not be liable for any damage to your system, any loss or corruption of any data or font, or any other loss or damage that you may suffer as a result of downloading or using these fonts, whether it results from Author's negligence or in any other way.
|
||||||
|
|
||||||
|
|
||||||
|
Author
|
||||||
|
|
||||||
|
Yuji Adachi, 9031
|
||||||
|
Website: http://9031.com/
|
||||||
|
Email: info@9031.com
|
||||||
|
©1997-2011 9031
|
||||||
|
```
|
||||||
|
|
||||||
|
## ebiten.png
|
||||||
|
|
||||||
|
```
|
||||||
|
http://www.sozai-page.com/02_sozai/b/b04/b04_002/b04_002.html
|
||||||
|
```
|
||||||
|
|
||||||
|
## gophers.jpg
|
||||||
|
|
||||||
|
```
|
||||||
|
http://blog.golang.org/go-programming-language-turns-two
|
||||||
|
```
|
||||||
|
|
||||||
|
## Other image files
|
||||||
|
|
||||||
|
```
|
||||||
|
Creative Commons Attribution 3.0 License
|
||||||
|
```
|
18
_docs/public/example/mosaic.html
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<!--
|
||||||
|
Copyright 2015 Hajime Hoshi
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
|
||||||
|
-->
|
||||||
|
<script src="mosaic.js"></script>
|
57
_docs/public/example/mosaic.js
Normal file
1
_docs/public/example/mosaic.js.map
Normal file
18
_docs/public/example/perspective.html
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<!--
|
||||||
|
Copyright 2015 Hajime Hoshi
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
|
||||||
|
-->
|
||||||
|
<script src="perspective.js"></script>
|
57
_docs/public/example/perspective.js
Normal file
1
_docs/public/example/perspective.js.map
Normal file
18
_docs/public/example/rotate.html
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<!--
|
||||||
|
Copyright 2015 Hajime Hoshi
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
|
||||||
|
-->
|
||||||
|
<script src="rotate.js"></script>
|
57
_docs/public/example/rotate.js
Normal file
1
_docs/public/example/rotate.js.map
Normal file
Before Width: | Height: | Size: 638 KiB |
@ -34,6 +34,12 @@ table.examples td.code pre {
|
|||||||
height: 240px;
|
height: 240px;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
}
|
}
|
||||||
|
table.examples iframe {
|
||||||
|
border-color: #999;
|
||||||
|
border-style: solid;
|
||||||
|
border-width: 1px;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
<h1>Ebiten (海老天)</h1>
|
<h1>Ebiten (海老天)</h1>
|
||||||
<p>v1.1.0-alpha</p>
|
<p>v1.1.0-alpha</p>
|
||||||
@ -64,7 +70,9 @@ table.examples td.code pre {
|
|||||||
<td class="code"><pre><code>// <b>blocks</b>
|
<td class="code"><pre><code>// <b>blocks</b>
|
||||||
|
|
||||||
// Please read example/blocks/main.go and example/blocks/blocks/*.go</code></pre></td>
|
// Please read example/blocks/main.go and example/blocks/blocks/*.go</code></pre></td>
|
||||||
<td><img src="blocks.gif" width="256" height="240"></td>
|
|
||||||
|
<td>(TODO: Implement link)</td>
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
@ -108,12 +116,14 @@ func main() {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
if err := ebiten.Run(update, screenWidth, screenHeight, 2, "Hue (Ebiten Demo)"); err != nil {
|
if err := ebiten.Run(update, screenWidth, screenHeight, 1, "Hue (Ebiten Demo)"); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</code></pre></td>
|
</code></pre></td>
|
||||||
<td><img src="hue.gif" width="320" height="240"></td>
|
|
||||||
|
<td><iframe src="example/hue.html" width="320" height="240"></iframe></td>
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
@ -161,12 +171,14 @@ func main() {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
if err := ebiten.Run(update, screenWidth, screenHeight, 2, "Mosaic (Ebiten Demo)"); err != nil {
|
if err := ebiten.Run(update, screenWidth, screenHeight, 1, "Mosaic (Ebiten Demo)"); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</code></pre></td>
|
</code></pre></td>
|
||||||
<td><img src="mosaic.gif" width="320" height="240"></td>
|
|
||||||
|
<td><iframe src="example/mosaic.html" width="320" height="240"></iframe></td>
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
@ -229,12 +241,14 @@ func main() {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
if err := ebiten.Run(update, screenWidth, screenHeight, 2, "Perspective (Ebiten Demo)"); err != nil {
|
if err := ebiten.Run(update, screenWidth, screenHeight, 1, "Perspective (Ebiten Demo)"); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</code></pre></td>
|
</code></pre></td>
|
||||||
<td><img src="perspective.gif" width="320" height="240"></td>
|
|
||||||
|
<td><iframe src="example/perspective.html" width="320" height="240"></iframe></td>
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
@ -279,12 +293,14 @@ func main() {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
if err := ebiten.Run(update, screenWidth, screenHeight, 2, "Rotate (Ebiten Demo)"); err != nil {
|
if err := ebiten.Run(update, screenWidth, screenHeight, 1, "Rotate (Ebiten Demo)"); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</code></pre></td>
|
</code></pre></td>
|
||||||
<td><img src="rotate.gif" width="320" height="240"></td>
|
|
||||||
|
<td><iframe src="example/rotate.html" width="320" height="240"></iframe></td>
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
|
Before Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 29 KiB |
Before Width: | Height: | Size: 691 KiB |
@ -50,7 +50,7 @@ func main() {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
if err := ebiten.Run(update, screenWidth, screenHeight, 2, "Hue (Ebiten Demo)"); err != nil {
|
if err := ebiten.Run(update, screenWidth, screenHeight, 1, "Hue (Ebiten Demo)"); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,7 @@ func main() {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
if err := ebiten.Run(update, screenWidth, screenHeight, 2, "Mosaic (Ebiten Demo)"); err != nil {
|
if err := ebiten.Run(update, screenWidth, screenHeight, 1, "Mosaic (Ebiten Demo)"); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -69,7 +69,7 @@ func main() {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
if err := ebiten.Run(update, screenWidth, screenHeight, 2, "Perspective (Ebiten Demo)"); err != nil {
|
if err := ebiten.Run(update, screenWidth, screenHeight, 1, "Perspective (Ebiten Demo)"); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,7 @@ func main() {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
if err := ebiten.Run(update, screenWidth, screenHeight, 2, "Rotate (Ebiten Demo)"); err != nil {
|
if err := ebiten.Run(update, screenWidth, screenHeight, 1, "Rotate (Ebiten Demo)"); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -62,11 +62,15 @@ func init() {
|
|||||||
|
|
||||||
htmlStyle := doc.Get("documentElement").Get("style")
|
htmlStyle := doc.Get("documentElement").Get("style")
|
||||||
htmlStyle.Set("height", "100%")
|
htmlStyle.Set("height", "100%")
|
||||||
|
htmlStyle.Set("margin", "0")
|
||||||
|
htmlStyle.Set("padding", "0")
|
||||||
|
|
||||||
bodyStyle := doc.Get("body").Get("style")
|
bodyStyle := doc.Get("body").Get("style")
|
||||||
bodyStyle.Set("backgroundColor", "#000")
|
bodyStyle.Set("backgroundColor", "#000")
|
||||||
bodyStyle.Set("position", "relative")
|
bodyStyle.Set("position", "relative")
|
||||||
bodyStyle.Set("height", "100%")
|
bodyStyle.Set("height", "100%")
|
||||||
|
bodyStyle.Set("margin", "0")
|
||||||
|
bodyStyle.Set("padding", "0")
|
||||||
|
|
||||||
canvasStyle := canvas.Get("style")
|
canvasStyle := canvas.Get("style")
|
||||||
canvasStyle.Set("position", "absolute")
|
canvasStyle.Set("position", "absolute")
|
||||||
@ -102,7 +106,7 @@ func Start(width, height, scale int, title string) (actualScale int, err error)
|
|||||||
canvas.Set("width", width*scale)
|
canvas.Set("width", width*scale)
|
||||||
canvas.Set("height", height*scale)
|
canvas.Set("height", height*scale)
|
||||||
canvasStyle := canvas.Get("style")
|
canvasStyle := canvas.Get("style")
|
||||||
canvasStyle.Set("top", "calc(50% - "+strconv.Itoa(width*scale/2)+"px)")
|
canvasStyle.Set("left", "calc(50% - "+strconv.Itoa(width*scale/2)+"px)")
|
||||||
canvasStyle.Set("left", "calc(50% - "+strconv.Itoa(height*scale/2)+"px)")
|
canvasStyle.Set("top", "calc(50% - "+strconv.Itoa(height*scale/2)+"px)")
|
||||||
return scale, nil
|
return scale, nil
|
||||||
}
|
}
|
||||||
|