@webwriter/geogebra 2.1.1 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +354 -721
- package/assets/preview-ar.mp4 +0 -0
- package/assets/preview-bn.mp4 +0 -0
- package/assets/preview-es.mp4 +0 -0
- package/assets/preview-fa.mp4 +0 -0
- package/assets/preview-fr.mp4 +0 -0
- package/assets/preview-hi.mp4 +0 -0
- package/assets/preview-id.mp4 +0 -0
- package/assets/preview-it.mp4 +0 -0
- package/assets/preview-ja.mp4 +0 -0
- package/assets/preview-jv.mp4 +0 -0
- package/assets/preview-ko.mp4 +0 -0
- package/assets/preview-mr.mp4 +0 -0
- package/assets/preview-nl.mp4 +0 -0
- package/assets/preview-pl.mp4 +0 -0
- package/assets/preview-pt.mp4 +0 -0
- package/assets/preview-ru.mp4 +0 -0
- package/assets/preview-sw.mp4 +0 -0
- package/assets/preview-ta.mp4 +0 -0
- package/assets/preview-te.mp4 +0 -0
- package/assets/preview-th.mp4 +0 -0
- package/assets/preview-tr.mp4 +0 -0
- package/assets/preview-ur.mp4 +0 -0
- package/assets/preview-vi.mp4 +0 -0
- package/assets/preview-zh.mp4 +0 -0
- package/custom-elements.json +2189 -3437
- package/dist/chunks/{chunk-RYZMQM25.js → chunk-T5C4HMRG.js} +8 -2
- package/dist/widgets/webwriter-geogebra-3d.js +1 -3
- package/dist/widgets/webwriter-geogebra-classic.js +1 -3
- package/dist/widgets/webwriter-geogebra-geometry.js +1 -3
- package/dist/widgets/webwriter-geogebra-notes.js +1 -3
- package/dist/widgets/webwriter-geogebra-scientific.js +1 -3
- package/dist/widgets/webwriter-geogebra.js +1 -3
- package/package.json +26 -1
- package/schemas/construction.schema.json +14 -0
- package/src/components/geogebra-app.ts +100 -58
- package/src/widgets/webwriter-geogebra-3d.ts +1 -3
- package/src/widgets/webwriter-geogebra-classic.ts +1 -3
- package/src/widgets/webwriter-geogebra-geometry.ts +1 -3
- package/src/widgets/webwriter-geogebra-notes.ts +1 -3
- package/src/widgets/webwriter-geogebra-scientific.ts +1 -3
- package/src/widgets/webwriter-geogebra.ts +3 -3
- package/tests/presentation.test.ts +6 -0
|
@@ -38,9 +38,13 @@ declare global {
|
|
|
38
38
|
* `image/png` and `image/svg+xml` export the picture of the graphics view; both need the loaded applet and are lossy
|
|
39
39
|
* (no construction steps, no algebra view). A file that is no zip archive is refused before the widget changes.
|
|
40
40
|
*
|
|
41
|
+
* @data {schemas/construction.schema.json} - The edited or imported construction.
|
|
41
42
|
* @part applet - The iframe that holds the GeoGebra applet.
|
|
43
|
+
* @cssprop --ww-text-color - Text color of the widget (the note shown when printing without a loaded applet).
|
|
44
|
+
* @cssprop --ww-font-family - Font of the widget.
|
|
45
|
+
* @cssprop --ww-link-color - Color of the focus ring around the applet.
|
|
42
46
|
* @fires focus - Fired when the GeoGebra applet gains focus.
|
|
43
|
-
* @fires ggb-load - Fired when the GeoGebra
|
|
47
|
+
* @fires ggb-load - Fired when the GeoGebra applet has loaded; `detail.api` is the applet's GeoGebra API (evalCommand, getBase64, …).
|
|
44
48
|
*/
|
|
45
49
|
export class GeogebraApp extends LitElementWw {
|
|
46
50
|
static styles = geogebraAppStyles
|
|
@@ -77,7 +81,7 @@ export class GeogebraApp extends LitElementWw {
|
|
|
77
81
|
})
|
|
78
82
|
|
|
79
83
|
/**
|
|
80
|
-
*
|
|
84
|
+
* Advanced: CSS text injected into the applet's iframe. It replaces the default rules, which align the app header (and on `<webwriter-geogebra>` also hide undo/redo). Usually leave unset.
|
|
81
85
|
*/
|
|
82
86
|
@property({type: String})
|
|
83
87
|
accessor ggbStyles: string = css`
|
|
@@ -87,25 +91,25 @@ export class GeogebraApp extends LitElementWw {
|
|
|
87
91
|
`.cssText
|
|
88
92
|
|
|
89
93
|
/**
|
|
90
|
-
*
|
|
94
|
+
* The GeoGebra app. Each tag sets its own (see its description; the listed default is the classic tag's). Set it only to switch apps, e.g. to "evaluator": the equation editor, a math input field.
|
|
91
95
|
*/
|
|
92
96
|
@property({type: String, attribute: true, reflect: true})
|
|
93
97
|
accessor type: "classic" | "geometry" | "3d" | "suite" | "evaluator" | "scientific" | "notes" = "classic"
|
|
94
98
|
|
|
95
99
|
/**
|
|
96
|
-
*
|
|
100
|
+
* Initial applet width in pixels. The widget then fits the applet to its container (300 to 2100 px wide, 16:9), so this does not set the displayed size.
|
|
97
101
|
*/
|
|
98
102
|
@property({type: Number, attribute: true, reflect: true})
|
|
99
103
|
accessor width: number = 800
|
|
100
104
|
|
|
101
105
|
/**
|
|
102
|
-
*
|
|
106
|
+
* Initial applet height in pixels. Like `width`, it does not set the displayed size (16:9, at least 18rem high).
|
|
103
107
|
*/
|
|
104
108
|
@property({type: Number, attribute: true, reflect: true})
|
|
105
109
|
accessor height: number = 450
|
|
106
110
|
|
|
107
111
|
/**
|
|
108
|
-
*
|
|
112
|
+
* Construction to load: "ggbid:<id>" for the material at geogebra.org/m/<id>, or the URL of a .ggb file. Leave out for a blank app. Edits and imports go to the data block instead.
|
|
109
113
|
*/
|
|
110
114
|
@property({type: String, attribute: true, reflect: true, converter: {
|
|
111
115
|
fromAttribute: (value: string | null) => value,
|
|
@@ -114,307 +118,339 @@ export class GeogebraApp extends LitElementWw {
|
|
|
114
118
|
accessor src: string | undefined
|
|
115
119
|
|
|
116
120
|
/**
|
|
117
|
-
* Color of the border line
|
|
121
|
+
* Color of the border line around the applet, e.g. "#cccccc".
|
|
118
122
|
*/
|
|
119
123
|
@property({type: String, attribute: true, reflect: true})
|
|
120
124
|
accessor borderColor: string = "gray"
|
|
121
125
|
|
|
122
126
|
/**
|
|
123
|
-
*
|
|
127
|
+
* Corner radius of the applet border in pixels.
|
|
124
128
|
*/
|
|
125
129
|
@property({type: Number, attribute: true, reflect: true})
|
|
126
130
|
accessor borderRadius: number = 1
|
|
127
131
|
|
|
128
132
|
/**
|
|
129
|
-
*
|
|
133
|
+
* Whether right-click opens context menus and object properties; "false" also turns off some shortcuts such as Delete.
|
|
134
|
+
* @type {"true" | "false"}
|
|
130
135
|
*/
|
|
131
136
|
@property({type: Boolean, attribute: true, reflect: true, converter: booleanAttributeConverter})
|
|
132
137
|
accessor enableRightClick = true
|
|
133
138
|
|
|
134
139
|
/**
|
|
135
|
-
*
|
|
140
|
+
* Whether learners can drag object labels.
|
|
141
|
+
* @type {"true" | "false"}
|
|
136
142
|
*/
|
|
137
143
|
@property({type: Boolean, attribute: true, reflect: true, converter: booleanAttributeConverter})
|
|
138
144
|
accessor enableLabelDrags = true
|
|
139
145
|
|
|
140
146
|
/**
|
|
141
|
-
*
|
|
147
|
+
* Whether learners can pan (Shift or Ctrl + drag) and zoom (Shift or Ctrl + wheel) the graphics view; "false" turns off moving and zooming the view altogether, so the visible area stays fixed. Hide the zoom buttons too, with `showzoombuttons="false"`.
|
|
148
|
+
* @type {"true" | "false"}
|
|
142
149
|
*/
|
|
143
150
|
@property({type: Boolean, attribute: true, reflect: true, converter: booleanAttributeConverter})
|
|
144
151
|
accessor enableShiftDragZoom = true
|
|
145
152
|
|
|
146
153
|
/**
|
|
147
|
-
*
|
|
154
|
+
* Whether zoom in, zoom out and home buttons appear in the graphics view.
|
|
155
|
+
* @type {"true" | "false"}
|
|
148
156
|
*/
|
|
149
157
|
@property({type: Boolean, attribute: true, reflect: true, converter: booleanAttributeConverter})
|
|
150
|
-
accessor showZoomButtons =
|
|
158
|
+
accessor showZoomButtons = true
|
|
151
159
|
|
|
152
160
|
/**
|
|
153
|
-
*
|
|
161
|
+
* Whether invalid input shows an error dialog.
|
|
162
|
+
* @type {"true" | "false"}
|
|
154
163
|
*/
|
|
155
164
|
@property({type: Boolean, attribute: true, reflect: true, converter: booleanAttributeConverter})
|
|
156
165
|
accessor errorDialogsActive = true
|
|
157
166
|
|
|
158
167
|
/**
|
|
159
|
-
*
|
|
168
|
+
* Whether GeoGebra's menu bar is shown.
|
|
169
|
+
* @type {"true" | "false"}
|
|
160
170
|
*/
|
|
161
171
|
@property({type: Boolean, attribute: true, reflect: true, converter: booleanAttributeConverter})
|
|
162
172
|
accessor showMenuBar = false
|
|
163
173
|
|
|
164
174
|
/**
|
|
165
|
-
*
|
|
175
|
+
* Whether the toolbar with the construction tools is shown; `customtoolbar` chooses its tools.
|
|
176
|
+
* @type {"true" | "false"}
|
|
166
177
|
*/
|
|
167
178
|
@property({type: Boolean, attribute: true, reflect: true, converter: booleanAttributeConverter})
|
|
168
179
|
accessor showToolBar = true
|
|
169
180
|
|
|
170
181
|
/**
|
|
171
|
-
*
|
|
182
|
+
* Whether a help text for the selected tool appears next to the toolbar.
|
|
183
|
+
* @type {"true" | "false"}
|
|
172
184
|
*/
|
|
173
185
|
@property({type: Boolean, attribute: true, reflect: true, converter: booleanAttributeConverter})
|
|
174
186
|
accessor showToolBarHelp = false
|
|
175
187
|
|
|
176
188
|
/**
|
|
177
|
-
*
|
|
189
|
+
* Tools in the toolbar: GeoGebra tool numbers, spaces between tools of one menu, "|" before the next menu, "," a separator in a menu. "0 | 1 | 15 | 10" gives Move, Point, Segment, Circle. Overrides the file's toolbar.
|
|
178
190
|
*/
|
|
179
191
|
@property({type: String, attribute: true, reflect: true})
|
|
180
192
|
accessor customToolBar: string | undefined
|
|
181
193
|
|
|
182
194
|
/**
|
|
183
|
-
*
|
|
195
|
+
* Whether the input line is shown, where learners type objects and commands such as f(x) = x^2 or Circle(A, 3).
|
|
196
|
+
* @type {"true" | "false"}
|
|
184
197
|
*/
|
|
185
198
|
@property({type: Boolean, attribute: true, reflect: true, converter: booleanAttributeConverter})
|
|
186
199
|
accessor showAlgebraInput = true
|
|
187
200
|
|
|
188
201
|
/**
|
|
189
|
-
*
|
|
202
|
+
* Whether an icon in the upper right corner resets the applet to the construction it loaded with.
|
|
203
|
+
* @type {"true" | "false"}
|
|
190
204
|
*/
|
|
191
205
|
@property({type: Boolean, attribute: true, reflect: true, converter: booleanAttributeConverter})
|
|
192
206
|
accessor showResetIcon = false
|
|
193
207
|
|
|
194
208
|
/**
|
|
195
|
-
*
|
|
209
|
+
* Applet language as an ISO 639-1 code such as "de". Usually leave out: the applet follows the nearest lang attribute, i.e. the document language.
|
|
196
210
|
*/
|
|
197
211
|
@property({type: String, attribute: true, reflect: true})
|
|
198
212
|
accessor language: string | undefined
|
|
199
213
|
|
|
200
214
|
/**
|
|
201
|
-
* ISO country
|
|
215
|
+
* ISO 3166 country code such as "AT" for a regional variant of the language. Left out, it is the region of the document language (none when `language` is set).
|
|
202
216
|
*/
|
|
203
217
|
@property({type: String, attribute: true, reflect: true})
|
|
204
218
|
accessor country: string | undefined
|
|
205
219
|
|
|
206
220
|
/**
|
|
207
|
-
*
|
|
221
|
+
* Id passed to GeoGebra as the applet id (the argument of ggbOnInit). Usually leave out.
|
|
208
222
|
*/
|
|
209
223
|
@property({type: String, attribute: true, reflect: true})
|
|
210
224
|
accessor appletId: string | undefined
|
|
211
225
|
|
|
212
226
|
/**
|
|
213
|
-
*
|
|
227
|
+
* Whether the style bar (color, line style and label of the selected object) can be shown.
|
|
228
|
+
* @type {"true" | "false"}
|
|
214
229
|
*/
|
|
215
230
|
@property({type: Boolean, attribute: true, reflect: true, converter: booleanAttributeConverter})
|
|
216
231
|
accessor allowStyleBar = false
|
|
217
232
|
|
|
218
233
|
/**
|
|
219
|
-
*
|
|
234
|
+
* Whether random numbers in the construction are drawn anew on each load; "false" keeps the saved values.
|
|
235
|
+
* @type {"true" | "false"}
|
|
220
236
|
*/
|
|
221
237
|
@property({type: Boolean, attribute: true, reflect: true, converter: booleanAttributeConverter})
|
|
222
238
|
accessor randomize = true
|
|
223
239
|
|
|
224
240
|
/**
|
|
225
|
-
*
|
|
241
|
+
* Integer seed for random numbers, so that every load draws the same values.
|
|
226
242
|
*/
|
|
227
243
|
@property({type: Number, attribute: true, reflect: true})
|
|
228
244
|
accessor randomSeed: number | undefined
|
|
229
245
|
|
|
230
246
|
/**
|
|
231
|
-
*
|
|
247
|
+
* Advanced: "true" ignores the scripts saved in the construction (ggbOnInit and object update scripts); "false" runs them.
|
|
248
|
+
* @type {"true" | "false"}
|
|
232
249
|
*/
|
|
233
250
|
@property({type: Boolean, attribute: true, reflect: true, converter: booleanAttributeConverter})
|
|
234
251
|
accessor useBrowserForJs = false
|
|
235
252
|
|
|
236
253
|
/**
|
|
237
|
-
*
|
|
254
|
+
* Whether GeoGebra writes log messages to the browser console.
|
|
255
|
+
* @type {"true" | "false"}
|
|
238
256
|
*/
|
|
239
257
|
@property({type: Boolean, attribute: true, reflect: true, converter: booleanAttributeConverter})
|
|
240
258
|
accessor showLogging = false
|
|
241
259
|
|
|
242
260
|
/**
|
|
243
|
-
*
|
|
261
|
+
* How easily pointer and touch select and drag objects; larger values (4 or 5) make it easier.
|
|
244
262
|
*/
|
|
245
263
|
@property({type: Number, attribute: true, reflect: true})
|
|
246
264
|
accessor capturingThreshold = 3
|
|
247
265
|
|
|
248
266
|
/**
|
|
249
|
-
*
|
|
267
|
+
* Whether the menu offers saving, opening, sign-in and saving settings; matters only with `showmenubar`. `<webwriter-geogebra>` defaults to "false".
|
|
268
|
+
* @type {"true" | "false"}
|
|
250
269
|
*/
|
|
251
270
|
@property({type: Boolean, attribute: true, reflect: true, converter: booleanAttributeConverter})
|
|
252
271
|
accessor enableFileFeatures = true
|
|
253
272
|
|
|
254
273
|
/**
|
|
255
|
-
*
|
|
274
|
+
* No effect yet: the widget does not pass it to GeoGebra. Undo and redo show with the toolbar, except on `<webwriter-geogebra>`, whose `ggbstyles` hide them.
|
|
275
|
+
* @type {"true" | "false"}
|
|
256
276
|
*/
|
|
257
277
|
@property({type: Boolean, attribute: true, reflect: true, converter: booleanAttributeConverter})
|
|
258
278
|
accessor enableUndoRedo = true
|
|
259
279
|
|
|
260
280
|
/**
|
|
261
|
-
*
|
|
281
|
+
* Views of a blank app (without `src`), as GeoGebra perspective letters: A algebra, G graphics, D graphics 2, T 3D graphics, S spreadsheet, C CAS, B probability, L construction protocol; e.g. "AG".
|
|
262
282
|
*/
|
|
263
283
|
@property({type: String, attribute: true, reflect: true})
|
|
264
284
|
accessor perspective: string | undefined
|
|
265
285
|
|
|
266
286
|
/**
|
|
267
|
-
* Whether 3D
|
|
287
|
+
* Whether 3D graphics are available; "false" removes them, e.g. for a test. Left out, the app decides.
|
|
288
|
+
* @type {"true" | "false"}
|
|
268
289
|
*/
|
|
269
290
|
@property({type: Boolean, attribute: true, reflect: true, converter: booleanAttributeConverter})
|
|
270
291
|
accessor enable3d: boolean | undefined
|
|
271
292
|
|
|
272
293
|
/**
|
|
273
|
-
* Whether CAS
|
|
294
|
+
* Whether the CAS (symbolic algebra: Solve, Factor, …) is available; "false" turns it off, e.g. for a test. Left out, the app decides.
|
|
295
|
+
* @type {"true" | "false"}
|
|
274
296
|
*/
|
|
275
297
|
@property({type: Boolean, attribute: true, reflect: true, converter: booleanAttributeConverter})
|
|
276
298
|
accessor enableCAS: boolean | undefined
|
|
277
299
|
|
|
278
300
|
/**
|
|
279
|
-
*
|
|
301
|
+
* Where the input line appears: "algebra" inside the algebra view, "top" or "bottom" of the applet. Left out, the construction decides.
|
|
280
302
|
*/
|
|
281
303
|
@property({type: String, attribute: true, reflect: true})
|
|
282
304
|
accessor algebraInputPosition: "algebra" | "top" | "bottom" | undefined
|
|
283
305
|
|
|
284
306
|
/**
|
|
285
|
-
*
|
|
307
|
+
* Whether the applet must not take the focus when it starts.
|
|
308
|
+
* @type {"true" | "false"}
|
|
286
309
|
*/
|
|
287
310
|
@property({type: Boolean, attribute: true, reflect: true, converter: booleanAttributeConverter})
|
|
288
311
|
accessor preventFocus = false
|
|
289
312
|
|
|
290
313
|
/**
|
|
291
|
-
*
|
|
314
|
+
* GeoGebra's scaling container (a CSS class). Leave out: the widget already fits the applet to its container.
|
|
292
315
|
*/
|
|
293
316
|
@property({type: String, attribute: true, reflect: true})
|
|
294
317
|
accessor scaleContainerClass: string | undefined
|
|
295
318
|
|
|
296
319
|
/**
|
|
297
|
-
*
|
|
320
|
+
* Only with `scalecontainerclass`: whether GeoGebra computes the height from the width.
|
|
321
|
+
* @type {"true" | "false"}
|
|
298
322
|
*/
|
|
299
323
|
@property({type: Boolean, attribute: true, reflect: true, converter: booleanAttributeConverter})
|
|
300
324
|
accessor autoHeight = true
|
|
301
325
|
|
|
302
326
|
/**
|
|
303
|
-
*
|
|
327
|
+
* Only with `scalecontainerclass`: whether GeoGebra may scale the applet up.
|
|
328
|
+
* @type {"true" | "false"}
|
|
304
329
|
*/
|
|
305
330
|
@property({type: Boolean, attribute: true, reflect: true, converter: booleanAttributeConverter})
|
|
306
331
|
accessor allowUpscale = false
|
|
307
332
|
|
|
308
333
|
/**
|
|
309
|
-
*
|
|
334
|
+
* Whether a preview image with a play button stands in for the applet until a learner clicks it.
|
|
335
|
+
* @type {"true" | "false"}
|
|
310
336
|
*/
|
|
311
337
|
@property({type: Boolean, attribute: true, reflect: true, converter: booleanAttributeConverter})
|
|
312
338
|
accessor playButton = false
|
|
313
339
|
|
|
314
340
|
/**
|
|
315
|
-
*
|
|
341
|
+
* Scale factor of the whole applet, texts and buttons included; 2 doubles it.
|
|
316
342
|
*/
|
|
317
343
|
@property({type: Number, attribute: true, reflect: true})
|
|
318
344
|
accessor scale = 1
|
|
319
345
|
|
|
320
346
|
/**
|
|
321
|
-
* Whether
|
|
347
|
+
* Whether a play/pause button for animations (e.g. animated sliders) is shown in the graphics view.
|
|
348
|
+
* @type {"true" | "false"}
|
|
322
349
|
*/
|
|
323
350
|
@property({type: Boolean, attribute: true, reflect: true, converter: booleanAttributeConverter})
|
|
324
351
|
accessor showAnimationButton = false
|
|
325
352
|
|
|
326
353
|
/**
|
|
327
|
-
* Whether fullscreen button
|
|
354
|
+
* Whether a fullscreen button is shown.
|
|
355
|
+
* @type {"true" | "false"}
|
|
328
356
|
*/
|
|
329
357
|
@property({type: Boolean, attribute: true, reflect: true, converter: booleanAttributeConverter})
|
|
330
|
-
accessor showFullscreenButton =
|
|
358
|
+
accessor showFullscreenButton = true
|
|
331
359
|
|
|
332
360
|
/**
|
|
333
|
-
* Whether suggestion buttons (special points, solve) in
|
|
361
|
+
* Whether suggestion buttons (special points, solve) appear in the algebra view.
|
|
362
|
+
* @type {"true" | "false"}
|
|
334
363
|
*/
|
|
335
364
|
@property({type: Boolean, attribute: true, reflect: true, converter: booleanAttributeConverter})
|
|
336
365
|
accessor showSuggestionButtons = false
|
|
337
366
|
|
|
338
367
|
/**
|
|
339
|
-
* Whether
|
|
368
|
+
* Whether GeoGebra's welcome tooltip appears at the start.
|
|
369
|
+
* @type {"true" | "false"}
|
|
340
370
|
*/
|
|
341
371
|
@property({type: Boolean, attribute: true, reflect: true, converter: booleanAttributeConverter})
|
|
342
372
|
accessor showStartTooltip = false
|
|
343
373
|
|
|
344
374
|
/**
|
|
345
|
-
*
|
|
375
|
+
* Displayed precision: decimal places, or significant digits with "s" ("2" rounds to 2 decimal places, "4s" to 4 significant digits). Left out, the construction decides.
|
|
346
376
|
*/
|
|
347
377
|
@property({type: String, attribute: true, reflect: true})
|
|
348
378
|
accessor rounding: string | undefined
|
|
349
379
|
|
|
350
380
|
/**
|
|
351
|
-
* Whether buttons
|
|
381
|
+
* Whether buttons in the graphics view have shadows.
|
|
382
|
+
* @type {"true" | "false"}
|
|
352
383
|
*/
|
|
353
384
|
@property({type: Boolean, attribute: true, reflect: true, converter: booleanAttributeConverter})
|
|
354
385
|
accessor buttonShadows = false
|
|
355
386
|
|
|
356
387
|
/**
|
|
357
|
-
*
|
|
388
|
+
* Corner radius of buttons in the graphics view, relative to half their height (radius = value × height / 2).
|
|
358
389
|
*/
|
|
359
390
|
@property({type: Number, attribute: true, reflect: true})
|
|
360
391
|
accessor buttonRounding = 0.2
|
|
361
392
|
|
|
362
393
|
/**
|
|
363
|
-
* Border color of buttons
|
|
394
|
+
* Border color of buttons in the graphics view, e.g. "#000000". Left out: black on white buttons, otherwise a shade darker than the button.
|
|
364
395
|
*/
|
|
365
396
|
@property({type: String, attribute: true, reflect: true})
|
|
366
397
|
accessor buttonBorderColor: string | undefined
|
|
367
398
|
|
|
368
399
|
/**
|
|
369
|
-
* Background color of the evaluator
|
|
400
|
+
* Background color of the equation editor (type "evaluator" only), e.g. "#ffffff".
|
|
370
401
|
*/
|
|
371
402
|
@property({type: String, attribute: true, reflect: true})
|
|
372
403
|
accessor editorBackgroundColor: string | undefined
|
|
373
404
|
|
|
374
405
|
/**
|
|
375
|
-
*
|
|
406
|
+
* Text color of the equation editor (type "evaluator" only), e.g. "#000000".
|
|
376
407
|
*/
|
|
377
408
|
@property({type: String, attribute: true, reflect: true})
|
|
378
409
|
accessor editorForegroundColor: string | undefined
|
|
379
410
|
|
|
380
411
|
/**
|
|
381
|
-
* Whether
|
|
412
|
+
* Whether the equation editor (type "evaluator") starts in text mode.
|
|
413
|
+
* @type {"true" | "false"}
|
|
382
414
|
*/
|
|
383
415
|
@property({type: Boolean, attribute: true, reflect: true, converter: booleanAttributeConverter})
|
|
384
416
|
accessor textmode = false
|
|
385
417
|
|
|
386
418
|
/**
|
|
387
|
-
* Whether
|
|
419
|
+
* Whether the on-screen keyboard opens when an input is focused: "true" always, "false" never. Left out: always in the equation editor, otherwise until the learner closes it.
|
|
420
|
+
* @type {"true" | "false"}
|
|
388
421
|
*/
|
|
389
422
|
@property({type: Boolean, attribute: true, reflect: true, converter: booleanAttributeConverter})
|
|
390
423
|
accessor showKeyboardOnFocus: boolean | undefined
|
|
391
424
|
|
|
392
425
|
/**
|
|
393
|
-
*
|
|
426
|
+
* On-screen keyboard of the equation editor (type "evaluator"): "scientific", "normal" or "notes".
|
|
394
427
|
*/
|
|
395
428
|
@property({type: String, attribute: true, reflect: true})
|
|
396
429
|
accessor keyboardType: "scientific" | "normal" | "notes" | undefined
|
|
397
430
|
|
|
398
431
|
/**
|
|
399
|
-
* Whether the
|
|
432
|
+
* Whether the graphics views have a transparent background.
|
|
433
|
+
* @type {"true" | "false"}
|
|
400
434
|
*/
|
|
401
435
|
@property({type: Boolean, attribute: true, reflect: true, converter: booleanAttributeConverter})
|
|
402
436
|
accessor transparentGraphics = false
|
|
403
437
|
|
|
404
438
|
/**
|
|
405
|
-
* Whether
|
|
439
|
+
* Whether JavaScript saved in the construction is blocked.
|
|
440
|
+
* @type {"true" | "false"}
|
|
406
441
|
*/
|
|
407
442
|
@property({type: Boolean, attribute: true, reflect: true, converter: booleanAttributeConverter})
|
|
408
443
|
accessor disabledJavaScript = false
|
|
409
444
|
|
|
410
445
|
/**
|
|
411
|
-
*
|
|
446
|
+
* CSS selector of an element to hold the on-screen keyboard. Leave out: the applet runs in the widget's own iframe.
|
|
412
447
|
*/
|
|
413
448
|
@property({type: String, attribute: true, reflect: true})
|
|
414
449
|
accessor detachedKeyboardParent: string | undefined
|
|
415
450
|
|
|
416
451
|
/**
|
|
417
452
|
* Used to force reset of the applet. Increment this property to reset the applet.
|
|
453
|
+
* @internal
|
|
418
454
|
*/
|
|
419
455
|
@property({type: Number})
|
|
420
456
|
protected accessor resetKey: number = 0
|
|
@@ -534,12 +570,14 @@ export class GeogebraApp extends LitElementWw {
|
|
|
534
570
|
}
|
|
535
571
|
}
|
|
536
572
|
|
|
573
|
+
/** Replaces the construction with the first of the given .ggb files (the "Import construction" action). */
|
|
537
574
|
async importConstruction(files: File[]) {
|
|
538
575
|
const file = files[0]
|
|
539
576
|
if (!file || !this.isConnected) return
|
|
540
577
|
this.src = ggbDataUrl(bytesToBase64(new Uint8Array(await file.arrayBuffer())))
|
|
541
578
|
}
|
|
542
579
|
|
|
580
|
+
/** Reads a .ggb file and returns a function that replaces the construction with it; throws for a file that is no zip archive. */
|
|
543
581
|
async importGgb(file: File) {
|
|
544
582
|
const bytes = new Uint8Array(await file.arrayBuffer())
|
|
545
583
|
if (!isGgbArchive(bytes)) throw new Error(this.msg("The file is not a GeoGebra construction (.ggb)."))
|
|
@@ -547,18 +585,21 @@ export class GeogebraApp extends LitElementWw {
|
|
|
547
585
|
return () => { this.src = src }
|
|
548
586
|
}
|
|
549
587
|
|
|
588
|
+
/** The current construction as a .ggb file, or null when there is none. */
|
|
550
589
|
exportGgb() {
|
|
551
590
|
const base64 = this.api?.getBase64() || dataUrlPayload(this.src)
|
|
552
591
|
if (!base64) return null
|
|
553
592
|
return new File([base64ToBytes(base64) as BlobPart], "construction.ggb", {type: GGB_MEDIA_TYPE})
|
|
554
593
|
}
|
|
555
594
|
|
|
595
|
+
/** A PNG picture of the graphics view, or null while the applet is not loaded. */
|
|
556
596
|
exportPng() {
|
|
557
597
|
const base64 = this.api?.getPNGBase64(1, false, 72)
|
|
558
598
|
if (!base64) return null
|
|
559
599
|
return new File([base64ToBytes(base64) as BlobPart], "construction.png", {type: "image/png"})
|
|
560
600
|
}
|
|
561
601
|
|
|
602
|
+
/** An SVG picture of the graphics view, or null while the applet is not loaded or after 8 seconds without an answer. */
|
|
562
603
|
exportSvg() {
|
|
563
604
|
const api = this.api
|
|
564
605
|
if (!api) return null
|
|
@@ -632,6 +673,7 @@ export class GeogebraApp extends LitElementWw {
|
|
|
632
673
|
this.resizer.observe(iframe)
|
|
633
674
|
}
|
|
634
675
|
|
|
676
|
+
/** Focuses the applet's iframe. */
|
|
635
677
|
focus(options?: FocusOptions) {
|
|
636
678
|
this.renderRoot.querySelector("iframe")?.focus(options)
|
|
637
679
|
}
|
|
@@ -2,14 +2,12 @@ import {customElement} from "lit/decorators.js"
|
|
|
2
2
|
import { GeogebraApp } from "../components/geogebra-app"
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* GeoGebra 3D Graphing Calculator (type "3d"): plot surfaces, planes, solids and points in space and rotate the view; use it for spatial geometry and functions of two variables. Load a construction with `src` or leave it out for an empty 3D view.
|
|
6
6
|
*/
|
|
7
7
|
@customElement("webwriter-geogebra-3d")
|
|
8
8
|
export class WebwriterGeogebra3d extends GeogebraApp {
|
|
9
9
|
constructor() {
|
|
10
10
|
super()
|
|
11
11
|
this.type = "3d" as const
|
|
12
|
-
this.showZoomButtons = true
|
|
13
|
-
this.showFullscreenButton = true
|
|
14
12
|
}
|
|
15
13
|
}
|
|
@@ -2,14 +2,12 @@ import {customElement} from "lit/decorators.js"
|
|
|
2
2
|
import { GeogebraApp } from "../components/geogebra-app"
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* GeoGebra Classic (type "classic"): the full app with algebra, graphics, spreadsheet and CAS views; use it to pick the views of a blank app (`perspective`), for graphs with an algebra view, or for a material whose app you do not know. Load a construction with `src` or leave it out for a blank app.
|
|
6
6
|
*/
|
|
7
7
|
@customElement("webwriter-geogebra-classic")
|
|
8
8
|
export class WebwriterGeogebraClassic extends GeogebraApp {
|
|
9
9
|
constructor() {
|
|
10
10
|
super()
|
|
11
11
|
this.type = "classic" as const
|
|
12
|
-
this.showZoomButtons = true
|
|
13
|
-
this.showFullscreenButton = true
|
|
14
12
|
}
|
|
15
13
|
}
|
|
@@ -2,14 +2,12 @@ import {customElement} from "lit/decorators.js"
|
|
|
2
2
|
import { GeogebraApp } from "../components/geogebra-app"
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* GeoGebra Geometry (type "geometry"): ruler-and-compass constructions with points, lines, circles, polygons and angles; use it for tasks such as constructing a perpendicular bisector. Load a construction with `src` or leave it out for a blank sheet.
|
|
6
6
|
*/
|
|
7
7
|
@customElement("webwriter-geogebra-geometry")
|
|
8
8
|
export class WebwriterGeogebraGeometry extends GeogebraApp {
|
|
9
9
|
constructor() {
|
|
10
10
|
super()
|
|
11
11
|
this.type = "geometry" as const
|
|
12
|
-
this.showZoomButtons = true
|
|
13
|
-
this.showFullscreenButton = true
|
|
14
12
|
}
|
|
15
13
|
}
|
|
@@ -2,14 +2,12 @@ import {customElement} from "lit/decorators.js"
|
|
|
2
2
|
import { GeogebraApp } from "../components/geogebra-app"
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* GeoGebra Notes (type "notes"): a whiteboard with pen, shapes, text and math input; use it for sketches, handwritten solutions and free notes. Load a saved board with `src` or leave it out for an empty board.
|
|
6
6
|
*/
|
|
7
7
|
@customElement("webwriter-geogebra-notes")
|
|
8
8
|
export class WebwriterGeogebraNotes extends GeogebraApp {
|
|
9
9
|
constructor() {
|
|
10
10
|
super()
|
|
11
11
|
this.type = "notes" as const
|
|
12
|
-
this.showZoomButtons = true
|
|
13
|
-
this.showFullscreenButton = true
|
|
14
12
|
}
|
|
15
13
|
}
|
|
@@ -2,14 +2,12 @@ import {customElement} from "lit/decorators.js"
|
|
|
2
2
|
import { GeogebraApp } from "../components/geogebra-app"
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* GeoGebra Scientific Calculator (type "scientific"): a calculator for fractions, powers, roots, trigonometry and logarithms; use it when learners need a calculator but no graphs or constructions. It is normally used without `src`.
|
|
6
6
|
*/
|
|
7
7
|
@customElement("webwriter-geogebra-scientific")
|
|
8
8
|
export class WebwriterGeogebraScientific extends GeogebraApp {
|
|
9
9
|
constructor() {
|
|
10
10
|
super()
|
|
11
11
|
this.type = "scientific" as const
|
|
12
|
-
this.showZoomButtons = true
|
|
13
|
-
this.showFullscreenButton = true
|
|
14
12
|
}
|
|
15
13
|
}
|
|
@@ -3,15 +3,15 @@ import {customElement} from "lit/decorators.js"
|
|
|
3
3
|
import { GeogebraApp } from "../components/geogebra-app"
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* GeoGebra Calculator Suite (type "suite"): learners switch between GeoGebra's graphing, geometry, 3D and CAS calculators in one applet; use it for open exploration. Load a construction with `src` or leave it out for a blank app.
|
|
7
|
+
*
|
|
8
|
+
* Unlike the other tags, it has no undo and redo buttons (its `ggbstyles` hide them) and `enablefilefeatures` defaults to "false".
|
|
7
9
|
*/
|
|
8
10
|
@customElement("webwriter-geogebra")
|
|
9
11
|
export class WebwriterGeogebra extends GeogebraApp {
|
|
10
12
|
constructor() {
|
|
11
13
|
super()
|
|
12
14
|
this.type = "suite" as const
|
|
13
|
-
this.showZoomButtons = true
|
|
14
|
-
this.showFullscreenButton = true
|
|
15
15
|
this.enableFileFeatures = false
|
|
16
16
|
this.enableUndoRedo = false
|
|
17
17
|
|
|
@@ -75,6 +75,12 @@ describe("presentation", function () {
|
|
|
75
75
|
assert.isTrue(await until(() => widget.shadowRoot.querySelector("iframe") !== frame));
|
|
76
76
|
});
|
|
77
77
|
|
|
78
|
+
it("shows the zoom and fullscreen buttons unless an attribute turns them off", async function () {
|
|
79
|
+
const widget = await mountIn(`<webwriter-geogebra-classic showfullscreenbutton="false"></webwriter-geogebra-classic>`, "webwriter-geogebra-classic");
|
|
80
|
+
assert.isTrue(widget.ggbProperties.showZoomButtons);
|
|
81
|
+
assert.isFalse(widget.ggbProperties.showFullscreenButton);
|
|
82
|
+
});
|
|
83
|
+
|
|
78
84
|
it("sizes the applet to the container at 300 and 2100 px", async function () {
|
|
79
85
|
this.timeout(15000);
|
|
80
86
|
const widget = await mountIn(`<div style="width: 300px"><webwriter-geogebra-classic></webwriter-geogebra-classic></div>`, "webwriter-geogebra-classic");
|