-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
81 lines (71 loc) · 2.6 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
// English:
//
// This example was taken from https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/orient
//
// Português:
//
// Este exemplo foi retirado do site https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/orient
//
// <svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg">
// <defs>
// <marker id="arrow" viewBox="0 0 10 10" refX="5" refY="5"
// markerWidth="6" markerHeight="6"
// orient="auto-start-reverse">
// <path d="M 0 0 L 10 5 L 0 10 z" />
// </marker>
//
// <marker id="dataArrow" viewBox="0 0 10 10" refX="5" refY="5"
// markerWidth="6" markerHeight="6"
// orient="-65deg">
// <path d="M 0 0 L 10 5 L 0 10 z" fill="red" />
// </marker>
// </defs>
//
// <polyline points="10,10 10,90 90,90" fill="none" stroke="black"
// marker-start="url(#arrow)" marker-end="url(#arrow)" />
//
// <polyline points="15,80 29,50 43,60 57,30 71,40 85,15" fill="none" stroke="grey"
// marker-start="url(#dataArrow)" marker-mid="url(#dataArrow)"
// marker-end="url(#dataArrow)" />
// </svg>
//go:build js
// +build js
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, 100, 100}).Append(
factoryBrowser.NewTagSvgDefs().Append(
factoryBrowser.NewTagSvgMarker().Id("arrow").ViewBox([]float64{0, 0, 10, 10}).RefX(5).RefY(5).MarkerWidth(6).MarkerHeight(6).Orient(html.KSvgOrientAutoStartReverse).Append(
factoryBrowser.NewTagSvgPath().D(factoryBrowser.NewPath().M(0, 0).L(10, 5).L(0, 10).Z()),
),
factoryBrowser.NewTagSvgMarker().Id("dataArrow").ViewBox([]float64{0, 0, 10, 10}).RefX(5).RefY(5).MarkerWidth(6).MarkerHeight(6).Orient(html.Degrees(-65)).Append(
factoryBrowser.NewTagSvgPath().D(factoryBrowser.NewPath().M(0, 0).L(10, 5).L(0, 10).Z()).Fill(factoryColor.NewRed()),
),
),
factoryBrowser.NewTagSvgPolyline().Points([][]float64{{10, 10}, {10, 90}, {90, 90}}).Fill(nil).Stroke(factoryColor.NewBlack()).MarkerStart("url(#arrow)").MarkerEnd("url(#arrow)"),
factoryBrowser.NewTagSvgPolyline().Points([][]float64{{15, 80}, {29, 50}, {43, 60}, {57, 30}, {71, 40}, {85, 15}}).Fill(nil).Stroke(factoryColor.NewGrey()).MarkerStart("url(#dataArrow)").MarkerMid("url(#dataArrow)").MarkerEnd("url(#dataArrow)"),
)
stage.Append(s1)
<-done
}
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//