... |
... |
@@ -180,7 +180,7 @@ The javascript library JSXgraph can be used in Mumie. For instance, examples fro |
180 |
180 |
*Caution*: Currently, the presentation only works with the old frontend. For showing the document in webmiau, one has to start the preview not using F8, but Ctrl+F8. |
181 |
181 |
|
182 |
182 |
|
183 |
|
-Example: |
|
183 |
+Example: (complete example at https://miau.mumie.net/web-miau/editor/content%2Fexamples%2FvisualizationExamples%2Fart_native_jsxgraph_1.src.tex ) |
184 |
184 |
```LaTeX |
185 |
185 |
\begin{jsxgraph} |
186 |
186 |
\jxgbox[400px][300px]{box1} |
... |
... |
@@ -208,24 +208,24 @@ The syntax is `\button[id]{label}{action}`. |
208 |
208 |
* The first mandatory parameter is the label text of the button |
209 |
209 |
* The second mandatory parameter describes the action when the button is clicked. It is given by the call of a function that has to be defined in the code-environment. |
210 |
210 |
|
211 |
|
-Example: |
|
211 |
+Example: (complete example at https://miau.mumie.net/web-miau/editor/content%2Fexamples%2FvisualizationExamples%2Fart_native_jsxgraph_button_2.src.tex ) |
212 |
212 |
```LaTeX |
213 |
213 |
\begin{jsxgraph} |
214 |
|
-\jxgbox[400px][300px]{box1} |
215 |
|
-\button{Change Q}{changeQ(aktRicht)} |
|
214 |
+\jxgbox[500px][300px]{box1} |
|
215 |
+\button{Change Q}{changeQ(currDir)} |
216 |
216 |
\begin{code} |
217 |
|
- var richtungen = ['oben', 'rechts', 'unten', 'links']; |
218 |
|
- const board = JXG.JSXGraph.initBoard('box1', {boundingbox: [-5, 2, 5, -2]}); |
|
217 |
+ var directions = ['oben', 'rechts', 'unten', 'links']; |
|
218 |
+ const board = JXG.JSXGraph.initBoard('box1', {boundingbox: [-5, 3, 5, -3]}); |
219 |
219 |
var p = board.create('point',[-3,1], {name:'P', size:3, face: 'o'}); |
220 |
220 |
var q = board.create('point',[1,-1], {name:'Q', size:3, face: '[]', fixed:true}); |
221 |
221 |
var l = board.create('line',[p,q], {name:'l'}); |
222 |
|
- var aktRicht = 'oben'; |
|
222 |
+ var currDir = 'oben'; |
223 |
223 |
function changeQ(direction) { |
224 |
224 |
switch (direction) { |
225 |
|
- case 'oben': q.moveTo([q.X(),q.Y()+1]); aktRicht = 'rechts'; break; |
226 |
|
- case 'rechts': q.moveTo([q.X()+1,q.Y()]); aktRicht = 'unten'; break; |
227 |
|
- case 'unten': q.moveTo([q.X(),q.Y()-1]); aktRicht = 'links'; break; |
228 |
|
- case 'links': q.moveTo([q.X()-1,q.Y()]); aktRicht = 'oben'; break; |
|
225 |
+ case 'oben': q.moveTo([q.X(),q.Y()+1]); currDir = 'rechts'; break; |
|
226 |
+ case 'rechts': q.moveTo([q.X()+1,q.Y()]); currDir = 'unten'; break; |
|
227 |
+ case 'unten': q.moveTo([q.X(),q.Y()-1]); currDir = 'links'; break; |
|
228 |
+ case 'links': q.moveTo([q.X()-1,q.Y()]); currDir = 'oben'; break; |
229 |
229 |
default: console.log('Unidentified direction'); |
230 |
230 |
} |
231 |
231 |
} |
232 |
232 |
|