-
Notifications
You must be signed in to change notification settings - Fork 8
/
sample.html
83 lines (71 loc) · 2.01 KB
/
sample.html
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
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Sample of Using RoCanvas.js</title>
<link rel="stylesheet" href="rocanvas.css?v=1.0">
<style>
body
{
font-family: verdana, sans-serif;
}
</style>
<!--[if lt IE 9]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body>
<h1>Example of Using RoCanvas.js</h1>
<p>For more info how this works see <a href="http://re.trotoys.com/article/rocanvas/" target="_blank">RoCanvas Documentation</a>.</p>
<h2>Default Settings Sample</h2>
<p>Below is just a canvas element that's turned into RoCanvas using the default settings.</p>
<div id="rodiv1"><canvas id="sampleBoard" width="500" height="500" style="border:1pt solid black"></canvas></div>
<h3>Source:</h3>
<code><pre>
var r=new RoCanvas;
r.RO("sampleBoard");
</pre></code>
<h2>Custom Settings Sample</h2>
<div id="rodiv2"><canvas id="sampleBoard2" width="700" height="500" style="border:1pt solid red"></canvas></div>
<h3>Source:</h3>
<code><pre>
var r2=new RoCanvas;
r2.RO("sampleBoard2", {
"toolbar": {
colors: ["pink", "#FFF","#000","#FF0000","#00FF00","#0000FF","#FFFF00","#00FFFF"],
custom_color: false,
tools: ['path', 'circle', 'rectangle'],
sizes: null,
saveButton: {"text": "Save", "callback": "testSave(r2);"}
},
"settings": {
color: 'pink'
}
});
</pre></code>
<script src="rocanvas.js"></script>
<script>
var r=new RoCanvas;
r.RO("sampleBoard");
var r2=new RoCanvas;
r2.RO("sampleBoard2", {
"toolbar": {
colors: ["pink", "#FFF","#000","#FF0000","#00FF00","#0000FF","#FFFF00","#00FFFF"],
custom_color: false,
tools: ['path', 'circle', 'rectangle'],
sizes: null,
saveButton: {"text": "Save", "callback": "testSave(r2);"}
},
"settings": {
color: 'pink'
}
});
function testSave(instance)
{
var data = instance.serialize();
// send ajax request to some URL using the data
// to do...
}
</script>
</body>
</html>