-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
90 lines (77 loc) · 2.43 KB
/
main.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
// English:
//
// This example was taken from https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/text-anchor
//
// Português:
//
// Este exemplo foi retirado do site https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/text-anchor
//
// <svg viewBox="0 0 120 120" xmlns="http://www.w3.org/2000/svg">
// <!-- Materialization of anchors -->
// <path d="M60,15 L60,110 M30,40 L90,40 M30,75 L90,75 M30,110 L90,110" stroke="grey" />
//
// <!-- Anchors in action -->
// <text text-anchor="start" x="60" y="40">A</text>
// <text text-anchor="middle" x="60" y="75">A</text>
// <text text-anchor="end" x="60" y="110">A</text>
//
// <!-- Materialization of anchors -->
// <circle cx="60" cy="40" r="3" fill="red" />
// <circle cx="60" cy="75" r="3" fill="red" />
// <circle cx="60" cy="110" r="3" fill="red" />
//
// <style><![CDATA[
// text {
// font: bold 36px Verdana, Helvetica, Arial, sans-serif;
// }
// ]]></style>
// </svg>
//go:build js
// +build js
// bug: o original não apararece nada
package main
import (
"github.com/helmutkemper/iotmaker.webassembly/browser/factoryBrowser"
"github.com/helmutkemper/iotmaker.webassembly/browser/html"
"github.com/helmutkemper/iotmaker.webassembly/platform/factoryColor"
)
func main() {
done := make(chan struct{}, 0)
stage := factoryBrowser.NewStage()
s1 := factoryBrowser.NewTagSvg().ViewBox([]float64{0, 0, 120, 120}).Append(
// Materialization of anchors
factoryBrowser.NewTagSvgPath().D(factoryBrowser.NewPath().M(60, 15).L(60, 110).M(30, 40).L(90, 40).M(30, 75).L(90, 75).M(30, 110).L(90, 110)).Stroke(factoryColor.NewGray()),
// Anchors in action
factoryBrowser.NewTagSvgText().TextAnchor(html.KSvgTextAnchorStart).X(60).Y(40).Text("A"),
factoryBrowser.NewTagSvgText().TextAnchor(html.KSvgTextAnchorMiddle).X(60).Y(75).Text("A"),
factoryBrowser.NewTagSvgText().TextAnchor(html.KSvgTextAnchorEnd).X(60).Y(110).Text("A"),
// Materialization of anchors
factoryBrowser.NewTagSvgCircle().Cx(60).Cy(40).R(3).Fill(factoryColor.NewRed()),
factoryBrowser.NewTagSvgCircle().Cx(60).Cy(75).R(3).Fill(factoryColor.NewRed()),
factoryBrowser.NewTagSvgCircle().Cx(60).Cy(110).R(3).Fill(factoryColor.NewRed()),
factoryBrowser.NewTagSvgStyle().Style(
//"<![CDATA[\n" +
"text {\n"+
"font: bold 36px Verdana, Helvetica, Arial, sans-serif;\n"+
"}\n",
//"]]>",
),
)
stage.Append(s1)
<-done
}
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//