File: index.html

package info (click to toggle)
schoolkit 0.2-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 328 kB
  • sloc: javascript: 404; sh: 16; makefile: 2
file content (113 lines) | stat: -rw-r--r-- 3,754 bytes parent folder | download
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<html>  
  <head>  
    <title>draggable school toolkit</title>
    <meta charset="utf-8" />
    <script type="text/javascript" src="/javascript/schoolkit/schoolkit.js"></script>
    <style type="text/css"> 
      .svg_container {
          border: 1px solid #aaa;
	  z-index: 10;
	  display: inline-block;
	  vertical-align: top;
      }   
    </style>
  </head>  
  <body>
    <fieldset>
      <legend>Translations</legend>
      <div style="display: inline-flex;">
	<a href="index.html">
	  <svg viewbox="0 0 25 15" style="width: 45px; height: 30px;">
	    <rect width="25" height="15" fill="#00247d"/>
	    <path d="M 0,0 L 25,15 M 25,0 L 0,15" stroke="#fff"
		  stroke-width="3"/>
	    <path d="M 12.5,0 V 15 M 0,7.5 H 25" stroke="#fff"
		  stroke-width="5"/>
	    <path d="M 12.5,0 V 15 M 0,7.5 H 25" stroke="#cf142b"
		  stroke-width="3"/>	  </svg>
	  <br/>
	  English
	</a>
      </div>
      <div style="display: inline-flex;">
	<a href="index-fr.html">
	  <svg viewbox="0 0 45 30" style="width: 45px; height: 30px;">
	    <rect x="0" y="0" width="15" height="30" style="fill: #0055ff;"/>
	    <rect x="15" y="0" width="15" height="30" style="fill: #ffffff;"/>
	    <rect x="30" y="0" width="15" height="30" style="fill: #ff4444;"/>
	  </svg>
	  <br/>
	  French
	</a>
      </div>
      <div style="display: inline-flex;">
	<a href="index-es.html">
	  <svg viewbox="0 0 45 30" style="width: 45px; height: 30px;">
	    <rect x="0" y="0" width="45" height="30" fill="#ad1519"/>
	    <rect x="0" y="8" width="45" height="14" fill="#fabd00"/>
	  </svg>
	  <br/>
	  Spanish
	</a>
      </div>
    </fieldset>
    <h1 style="color: orange;">Draggable school toolkit</h1>
    <h2>How to add a new tool</h2>
    <p>
      The JavaScript class GeomToolFromFile allows one to insert objects
      defined in SVG files. Example:
    </p>
    <pre>
	let p = new GeomPaper("canvas_container1", 1000, 600);
	let o3 = new GeomToolFromFile(
	  p, "equerre01",
	  "/usr/share/javascript/schoolkit/equerre01.svg",
	  new DOMPoint(300,150),
	  1);
    </pre>
    <p>
      The SVG file must contain
      <ul>
	<li>A &lt;g&gt; group element with an attribute id="layer1";
	  this group must then contain:</li>
	<li>A &lt;circle&gt; circle element whose center, defined by the
	  attributes cx and cy will be the center of rotation for the
	  geometric tool; this circle must have the attribute id="centre";
	</li>
	<li>A random graphic element, with the attribute
	  id="rotation_handle"; it should not overlap the central point,
	  because it will be used to control the rotation upon dragging;
	</li>
	<li>A random graphic element, with the attribute
	  id="translation_handle" which will be used to control the
	  translation upon dragging;
	</li>
	<li>
	  And any number of other graphic elements appended to the
	  main group.
	</li>
      </ul>
    </p>
    <h2>Demo</h2>
    <div class="svg_container" id="canvas_container1"></div>
    <script>
      let p = new GeomPaper("canvas_container1", 1000, 600);
      p.quadrillage();
      
      let o1 = new GeomToolFromFile(p, "rapporteur01", "/javascript/schoolkit/rapporteur01.svg",
				    new DOMPoint(500,300), 1);
      
      // let o2 = new DoubleDecimetre(p, 105, 100, "dd01")
      // p.addTool(o2, new DOMPoint(100,100), 3);
      let o2 = new GeomToolFromFile(p, "dd01", "/javascript/schoolkit/double_decimetre01.svg",
				    new DOMPoint(100,100), 1);

      let o3 = new GeomToolFromFile(p, "equerre01", "/javascript/schoolkit/equerre01.svg",
				   new DOMPoint(300,150), 1);
    </script>
    <div style="display: inline-block; vertical-align: top;">
      <button onclick="p.rescale(0.8)">-20%</button><br/>
      <button onclick="p.rescale(1.2)">+20%</button>
    </div>
  </body>
</html>