This repository has been archived by the owner on Sep 19, 2024. It is now read-only.
forked from jsxgraph/jsxgraph
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoptions.js
4370 lines (3937 loc) · 134 KB
/
options.js
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
Copyright 2008-2018
Matthias Ehmann,
Michael Gerhaeuser,
Carsten Miller,
Bianca Valentin,
Alfred Wassermann,
Peter Wilfahrt
This file is part of JSXGraph.
JSXGraph is free software dual licensed under the GNU LGPL or MIT License.
You can redistribute it and/or modify it under the terms of the
* GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version
OR
* MIT License: https://github.com/jsxgraph/jsxgraph/blob/master/LICENSE.MIT
JSXGraph is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License and
the MIT License along with JSXGraph. If not, see <http://www.gnu.org/licenses/>
and <http://opensource.org/licenses/MIT/>.
*/
/*global JXG:true, define: true*/
/*jslint nomen: true, plusplus: true*/
/* depends:
jxg
base/constants
math/math
utils/color
utils/type
*/
define([
'jxg', 'base/constants', 'math/math', 'utils/color', 'utils/type'
], function (JXG, Const, Mat, Color, Type) {
"use strict";
/**
* Options Namespace
* @description These are the default options of the board and of all geometry elements.
* @namespace
* @name JXG.Options
*/
JXG.Options = {
jc: {
enabled: true,
compile: true
},
/*
* Options that are used directly within the board class
*/
board: {
/**#@+
* @visprop
*/
//updateType: 'hierarchical', // 'all'
/**
* Bounding box of the visible area in user coordinates.
* It is an array consisting of four values:
* [x<sub>1</sub>, y<sub>1</sub>, x<sub>2</sub>, y<sub>2</sub>]
*
* The canvas will be spanned from the upper left corner (<sub>1</sub>, y<sub>1</sub>)
* to the lower right corner (x<sub>2</sub>, y<sub>2</sub>).
*
* @name JXG.Board#boundingbox
* @type Array
* @default [-5, 5, 5, -5]
*/
boundingBox: [-5, 5, 5, -5],
/**
* Additional zoom factor multiplied to {@link JXG.Board#zoomX} and {@link JXG.Board#zoomY}.
*
* @name JXG.Board#zoomFactor
* @type Number
* @default 1.0
*/
zoomFactor: 1,
/**
* Zoom factor in horizontal direction.
*
* @name JXG.Board#zoomX
* @see JXG.Board#zoomY
* @type Number
* @default 1.0
*/
zoomX: 1,
/**
* Zoom factor in vertical direction.
*
* @name JXG.Board#zoomY
* @see JXG.Board#zoomX
* @type Number
* @default 1.0
*/
zoomY: 1,
/**
* Show copyright string in canvas.
*
* @name JXG.Board#showCopyright
* @type Boolean
* @default true
*/
showCopyright: true,
/**
* Show default axis.
* If shown, the horizontal axis can be accessed via JXG.Board.defaultAxes.x, the
* vertical axis can be accessed via JXG.Board.defaultAxes.y.
* Both axes have a sub-element "defaultTicks".
*
* Value can be Boolean or an object containing axis attributes.
*
* @name JXG.Board#axis
* @type Boolean
* @default false
*/
axis: false,
/**
* Attributes for the default axes in case of the attribute
* axis:true in {@link JXG.JSXGraph#initBoard}.
*
* @name JXG.Board#defaultAxes
* @type {Object}
* @default {x: {name:'x'}, y: {name: 'y'}}
*
*/
defaultAxes: {
x: {
name: 'x',
ticks: {
label: {
visible: 'inherit',
anchorX: 'middle',
anchorY: 'top',
fontSize: 12,
offset: [0, -3]
},
drawZero: false,
visible: 'inherit'
}
},
y: {
name: 'y',
ticks: {
label: {
visible: 'inherit',
anchorX: 'right',
anchorY: 'middle',
fontSize: 12,
offset: [-6, 0]
},
tickEndings: [1, 0],
drawZero: false,
visible: 'inherit'
}
}
},
/**
* Display of navigation arrows and zoom buttons
*
* @name JXG.Board#showNavigation
* @type Boolean
* @default true
*/
showNavigation: true,
/**
* Display of zoom buttons. To show zoom buttons, additionally
* showNavigation has to be set to true.
*
* @name JXG.Board#showZoom
* @type Boolean
* @default true
*/
showZoom: true,
/**
* Show a button to force reload of a construction.
* Works only with the JessieCode tag
*
* @name JXG.Board#showReload
* @type Boolean
* @default false
*/
showReload: false,
showScreenshot: false,
screenshot: {
scale: 1.0,
type: 'png',
symbol: '\u2318', //'\u22b9', //'\u26f6',
css: 'background-color:#eeeeee; opacity:1.0; border:2px solid black; border-radius:10px; text-align:center',
cssButton: 'padding: 4px 10px; border: solid #356AA0 1px; border-radius: 5px; position: absolute; right: 2ex; top: 2ex; background-color: rgba(255, 255, 255, 0.3);'
},
/**
* Show a button which allows to clear all traces of a board.
*
* @name JXG.Board#showClearTraces
* @type Boolean
* @default false
*/
showClearTraces: false,
/**
* If set to true the bounding box might be changed such that
* the ratio of width and height of the hosting HTML div is equal
* to the ratio of wifth and height of the bounding box.
*
* This is necessary if circles should look like circles and not
* like ellipses. It is recommended to set keepAspectRatio = true
* for geometric applets. For function plotting keepAspectRatio = false
* might be the better choice.
*
* @name JXG.Board#keepAspectRatio
* @see JXG.Board#boundingbox
* @see JXG.Board#setBoundingBox
* @type Boolean
* @default false
*/
keepAspectRatio: false,
/**
* If set true and
* hasPoint() is true for both an element and it's label,
* the element (and not the label) is taken as drag element.
*
* If set false and hasPoint() is true for both an element and it's label,
* the label is taken (if it is on a higher layer than the element)
*
* @name JXG.Board#ignoreLabels
* @type Booelan
* @default true
*/
ignoreLabels: true,
/**
* Maximum number of digits in automatic label generation.
* For example, if set to 1 automatic point labels end at "Z".
* If set to 2, point labels end at "ZZ".
*
* @name JXG.Board#maxNameLength
* @see JXG.Board#generateName
* @type Number
* @default 1
*/
maxNameLength: 1,
/**
* Supply the document object. Defaults to window.document
*
* @name JXG.Board#document
* @type DOM object
* @default false (meaning window.document)
*/
document: false,
/**
* If true the first element of the set JXG.board.objects having hasPoint==true is taken as drag element.
*
* @name JXG.Board#takeFirst
* @type Boolean
* @default false
*/
takeFirst: false,
/**
* If true, when read from a file or string - the size of the div can be changed by the construction text.
*
* @name JXG.Board#takeSizeFromFile
* @type Boolean
* @default false
*/
takeSizeFromFile: false,
/**
* Default rendering engine. Possible values are 'svg', 'canvas', 'vml', 'no', or 'auto'.
* If the rendering engine is not available JSXGraph tries to detect a different engine.
*
* <p>
* In case of 'canvas' it is advisable to call 'board.update()' after all elements have been
* constructed. This ensures that all elements are drawn with their intended visual appearance.
*
* @name JXG.Board#renderer
* @type String
* @default 'auto'
*/
renderer: 'auto',
/**
* Time (in msec) between two animation steps. Used in
* {@link JXG.CoordsElement#moveAlong}, {@link JXG.CoordsElement#moveTo} and
* {@link JXG.CoordsElement#visit}.
*
* @name JXG.Board#animationDelay
* @type Number
* @default 35
* @see JXG.CoordsElement#moveAlong
* @see JXG.CoordsElement#moveTo
* @see JXG.CoordsElement#visit
*/
animationDelay: 35,
/**
* Allow user interaction by registering mouse and touch events.
*
* @name JXG.Board#registerEvents
* @type Boolean
* @default true
*/
registerEvents: true,
/**
* Change redraw strategy in SVG rendering engine.
*
* If set to 'svg', before every redrawing of the JSXGraph construction
* the SVG sub-tree of the DOM tree is taken out of the DOM.
*
* If set to 'all', before every redrawing of the JSXGraph construction the
* complete DOM tree is taken out of the DOM.
* If set to 'none' the redrawing is done in-place.
*
* Using 'svg' or 'all' speeds up the update process considerably. The risk
* is that if there is an exception, only a white div or window is left.
*
* @name JXG.Board#minimizeReflow
* @type String
* @default 'svg'
*/
minimizeReflow: 'svg',
/**
* A number that will be added to the absolute position of the board used in mouse coordinate
* calculations in {@link JXG.Board#getCoordsTopLeftCorner}.
*
* @name JXG.Board#offsetX
* @see JXG.Board#offsetY
* @type Number
* @default 0
*/
offsetX: 0,
/**
* A number that will be added to the absolute position of the board used in mouse coordinate
* calculations in {@link JXG.Board#getCoordsTopLeftCorner}.
*
* @name JXG.Board#offsetY
* @see JXG.Board#offsetX
* @type Number
* @default 0
*/
offsetY: 0,
/**
* Control the possibilities for zoom interaction.
*
* Possible sub-attributes with default values are:
* <pre>
* zoom: {
* factorX: 1.25, // horizontal zoom factor (multiplied to {@link JXG.Board#zoomX})
* factorY: 1.25, // vertical zoom factor (multiplied to {@link JXG.Board#zoomY})
* wheel: true, // allow zooming by mouse wheel or
* // by pinch-to-toom gesture on touch devices
* needShift: true, // mouse wheel zooming needs pressing of the shift key
* min: 0.001 // minimal values of {@link JXG.Board#zoomX} and {@link JXG.Board#zoomY}, limits zoomOut
* max: 1000.0 // maximal values of {@link JXG.Board#zoomX} and {@link JXG.Board#zoomY}, limits zoomIn
*
* pinchHorizontal: true // Allow pinch-to-zoom to zoom only horizontal axis
* pinchVertical: true // Allow pinch-to-zoom to zoom only vertical axis
* pinchSensitivity: 7 // Sensitivity (in degrees) for recognizing horizontal or vertical pinch-to-zoom gestures.
* }
* </pre>
*
* Deprecated: zoom.eps which is superseded by zoom.min
*
* @name JXG.Board#zoom
* @type Object
* @default
*/
zoom: {
enabled: true,
factorX: 1.25,
factorY: 1.25,
wheel: true,
needShift: true,
min: 0.0001,
max: 10000.0,
pinchHorizontal: true,
pinchVertical: true,
pinchSensitivity: 7
},
/**
* Control the possibilities for panning interaction (i.e. moving the origin).
*
* Possible sub-attributes with default values are:
* <pre>
* pan: {
* enabled: true // Allow panning
* needTwoFingers: true, // panning is done with two fingers on touch devices
* needShift: true, // mouse panning needs pressing of the shift key
* }
* </pre>
*
* @name JXG.Board#pan
* @type Object
* @default
*/
pan: {
needShift: true,
needTwoFingers: false,
enabled: true
},
/**
* Control the possibilities for a selection rectangle.
* Starting a selection event triggers the "startselecting" event.
* When the mouse pointer is released, the "stopselecting" event is fired.
* The "stopselecting" event must be supplied by the user.
* <p>
* Possible sub-attributes with default values are:
* <pre>
* selection: {
* enabled: false,
* name: 'selectionPolygon',
* needShift: false, // mouse selection needs pressing of the shift key
* needCtrl: true, // mouse selection needs pressing of the shift key
* withLines: false, // Selection polygon has border lines
* vertices: {
* visible: false
* },
* fillColor: '#ffff00',
* visible: false // Initial visibility. Should be set to false always
* }
* </pre>
*
* @example
* board.on('stopselecting', function(){
* var box = board.stopSelectionMode(),
* // bbox has the coordinates of the selectionr rectangle.
* // Attention: box[i].usrCoords have the form [1, x, y], i.e.
* // are homogeneous coordinates.
* bbox = box[0].usrCoords.slice(1).concat(box[1].usrCoords.slice(1));
* // Set a new bounding box
* board.setBoundingBox(bbox, false);
* });
*
* @name JXG.Board#selection
* @see JXG.Board#startselecting
* @see JXG.Board#stopselecting
* @see JXG.Board#mousestartselecting
* @see JXG.Board#pointerstartselecting
* @see JXG.Board#touchstartselecting
* @see JXG.Board#mousestopselecting
* @see JXG.Board#pointerstopselecting
* @see JXG.Board#touchstopselecting
* @type Object
* @default
*/
selection: {
enabled: false,
name: 'selectionPolygon',
needShift: false,
needCtrl: true,
withLines: false,
vertices: {
visible: false
},
fillColor: '#ffff00',
visible: false
}
/**#@-*/
},
/**
* Options that are used by the navigation bar.
*
* Default values are
* <pre>
* JXG.Option.navbar: {
* strokeColor: '#333333',
* fillColor: 'transparent',
* highlightFillColor: '#aaaaaa',
* padding: '2px',
* position: 'absolute',
* fontSize: '14px',
* cursor: 'pointer',
* zIndex: '100',
* right: '5px',
* bottom: '5px'
* },
* </pre>
*/
navbar: {
strokeColor: '#333333', //'#aaaaaa',
fillColor: 'transparent', //#f5f5f5',
highlightFillColor: '#aaaaaa',
padding: '2px',
position: 'absolute',
fontSize: '14px',
cursor: 'pointer',
zIndex: '100',
right: '5px',
bottom: '5px'
//border: 'none 1px black',
//borderRadius: '4px'
},
/*
* Generic options used by {@link JXG.GeometryElement}
*/
elements: {
// the following tag is a meta tag: http://code.google.com/p/jsdoc-toolkit/wiki/MetaTags
/**#@+
* @visprop
*/
/**
* The stroke color of the given geometry element.
* @type String
* @name JXG.GeometryElement#strokeColor
* @see JXG.GeometryElement#highlightStrokeColor
* @see JXG.GeometryElement#strokeWidth
* @see JXG.GeometryElement#strokeOpacity
* @see JXG.GeometryElement#highlightStrokeOpacity
* @default {@link JXG.Options.elements.color#strokeColor}
*/
strokeColor: '#0000ff',
/**
* The stroke color of the given geometry element when the user moves the mouse over it.
* @type String
* @name JXG.GeometryElement#highlightStrokeColor
* @see JXG.GeometryElement#strokeColor
* @see JXG.GeometryElement#strokeWidth
* @see JXG.GeometryElement#strokeOpacity
* @see JXG.GeometryElement#highlightStrokeOpacity
* @default {@link JXG.Options.elements.color#highlightStrokeColor}
*/
highlightStrokeColor: '#C3D9FF',
/**
* The fill color of this geometry element.
* @type String
* @name JXG.GeometryElement#fillColor
* @see JXG.GeometryElement#highlightFillColor
* @see JXG.GeometryElement#fillOpacity
* @see JXG.GeometryElement#highlightFillOpacity
* @default {@link JXG.Options.elements.color#fillColor}
*/
fillColor: 'red',
/**
* The fill color of the given geometry element when the mouse is pointed over it.
* @type String
* @name JXG.GeometryElement#highlightFillColor
* @see JXG.GeometryElement#fillColor
* @see JXG.GeometryElement#fillOpacity
* @see JXG.GeometryElement#highlightFillOpacity
* @default {@link JXG.Options.elements.color#highlightFillColor}
*/
highlightFillColor: 'none',
/**
* Opacity for element's stroke color.
* @type number
* @name JXG.GeometryElement#strokeOpacity
* @see JXG.GeometryElement#strokeColor
* @see JXG.GeometryElement#highlightStrokeColor
* @see JXG.GeometryElement#strokeWidth
* @see JXG.GeometryElement#highlightStrokeOpacity
* @default {@link JXG.Options.elements#strokeOpacity}
*/
strokeOpacity: 1,
/**
* Opacity for stroke color when the object is highlighted.
* @type number
* @name JXG.GeometryElement#highlightStrokeOpacity
* @see JXG.GeometryElement#strokeColor
* @see JXG.GeometryElement#highlightStrokeColor
* @see JXG.GeometryElement#strokeWidth
* @see JXG.GeometryElement#strokeOpacity
* @default {@link JXG.Options.elements#highlightStrokeOpacity}
*/
highlightStrokeOpacity: 1,
/**
* Opacity for fill color.
* @type number
* @name JXG.GeometryElement#fillOpacity
* @see JXG.GeometryElement#fillColor
* @see JXG.GeometryElement#highlightFillColor
* @see JXG.GeometryElement#highlightFillOpacity
* @default {@link JXG.Options.elements.color#fillOpacity}
*/
fillOpacity: 1,
/**
* Opacity for fill color when the object is highlighted.
* @type number
* @name JXG.GeometryElement#highlightFillOpacity
* @see JXG.GeometryElement#fillColor
* @see JXG.GeometryElement#highlightFillColor
* @see JXG.GeometryElement#fillOpacity
* @default {@link JXG.Options.elements.color#highlightFillOpacity}
*/
highlightFillOpacity: 1,
/**
* Transition duration (in milliseconds) for color and opacity
* changes. Works in SVG renderer, only.
* @type Number
* @name JXG.GeometryElement#transitionDuration
* @see JXG.GeometryElement#strokeColor
* @see JXG.GeometryElement#highlightStrokeColor
* @see JXG.GeometryElement#strokeOpacity
* @see JXG.GeometryElement#highlightStrokeOpacity
* @see JXG.GeometryElement#fillColor
* @see JXG.GeometryElement#highlightFillColor
* @see JXG.GeometryElement#fillOpacity
* @see JXG.GeometryElement#highlightFillOpacity
* @default {@link JXG.Options.elements#transitionDuration}
*/
transitionDuration: 100,
/**
* Width of the element's stroke.
* @type number
* @name JXG.GeometryElement#strokeWidth
* @see JXG.GeometryElement#strokeColor
* @see JXG.GeometryElement#highlightStrokeColor
* @see JXG.GeometryElement#strokeOpacity
* @see JXG.GeometryElement#highlightStrokeOpacity
* @default {@link JXG.Options.elements#strokeWidth}
*/
strokeWidth: 2,
/**
* Width of the element's stroke when the mouse is pointed over it.
* @type number
* @name JXG.GeometryElement#highlightStrokeWidth
* @see JXG.GeometryElement#strokeColor
* @see JXG.GeometryElement#highlightStrokeColor
* @see JXG.GeometryElement#strokeOpacity
* @see JXG.GeometryElement#highlightStrokeOpacity
* @see JXG.GeometryElement#highlightFillColor
* @default {@link JXG.Options.elements#strokeWidth}
*/
highlightStrokeWidth: 2,
/**
* If true the element is fixed and can not be dragged around. The element
* will be repositioned on zoom and moveOrigin events.
* @type Boolean
* @default false
* @name JXG.GeometryElement#fixed
*/
fixed: false,
/**
* If true the element is fixed and can not be dragged around. The element
* will even stay at its position on zoom and moveOrigin events.
* Only free elements like points, texts, curves can be frozen.
* @type Boolean
* @default false
* @name JXG.GeometryElement#frozen
*/
frozen: false,
/**
* If true a label will display the element's name.
* @type Boolean
* @default false
* @name JXG.GeometryElement#withLabel
*/
withLabel: false,
/**
* If false the element won't be visible on the board, otherwise it is shown.
* @type boolean
* @name JXG.GeometryElement#visible
* @see JXG.GeometryElement#hideElement
* @see JXG.GeometryElement#showElement
* @default true
*/
visible: true,
/**
* A private element will be inaccessible in certain environments, e.g. a graphical user interface.
* @default false
*/
priv: false,
/**
* Display layer which will contain the element.
* @see JXG.Options#layer
* @default See {@link JXG.Options#layer}
*/
layer: 0,
/**
* Determines the elements border-style.
* Possible values are:
* <ul><li>0 for a solid line</li>
* <li>1 for a dotted line</li>
* <li>2 for a line with small dashes</li>
* <li>3 for a line with medium dashes</li>
* <li>4 for a line with big dashes</li>
* <li>5 for a line with alternating medium and big dashes and large gaps</li>
* <li>6 for a line with alternating medium and big dashes and small gaps</li></ul>
* @type Number
* @name JXG.GeometryElement#dash
* @default 0
*/
dash: 0,
/**
* If true the element will get a shadow.
* @type boolean
* @name JXG.GeometryElement#shadow
* @default false
*/
shadow: false,
/**
* If true the element will be traced, i.e. on every movement the element will be copied
* to the background. Use {@link JXG.GeometryElement#clearTrace} to delete the trace elements.
* @see JXG.GeometryElement#clearTrace
* @see JXG.GeometryElement#traces
* @see JXG.GeometryElement#numTraces
* @type Boolean
* @default false
* @name JXG.GeometryElement#trace
*/
trace: false,
/**
* Extra visual properties for traces of an element
* @type Object
* @see JXG.GeometryElement#trace
* @name JXG.GeometryElement#traceAttributes
*/
traceAttributes: {},
/**
*
* @type Boolean
* @default true
* @name JXG.GeometryElement#highlight
*/
highlight: true,
/**
* If this is set to true, the element is updated in every update
* call of the board. If set to false, the element is updated only after
* zoom events or more generally, when the bounding box has been changed.
* Examples for the latter behaviour should be axes.
* @type Boolean
* @default true
* @see JXG.GeometryElement#needsRegularUpdate
* @name JXG.GeometryElement#needsRegularUpdate
*/
needsRegularUpdate: true,
/**
* Snaps the element or its parents to the grid. Currently only relevant for points, circles,
* and lines. Points are snapped to grid directly, on circles and lines it's only the parent
* points that are snapped
* @type Boolean
* @default false
* @name JXG.GeometryElement#snapToGrid
*/
snapToGrid: false,
/**
* Determines whether two-finger manipulation of this object may change its size.
* If set to false, the object is only rotated and translated.
* <p>
* In case the element is a horizontal or vertical line having ticks, "scalable==true"
* enables zooming of the board by dragging ticks lines. This feature is enabled,
* for the ticks element of the line element the attribute "fixed" has to be false
* and the line element's scalable attribute has to be true.
*
* @type Boolean
* @default true
* @name JXG.GeometryElement#scalable
* @see JXG.Ticks#fixed
*/
scalable: true,
/**
* If the element is dragged it will be moved on mousedown or touchstart to the
* top of its layer. Works only for SVG renderer and for ssimple elements
* consisting of one SVG node.
* @type Boolean
* @default false
* @name JXG.GeometryElement#scalable
*/
dragToTopOfLayer: false,
/*draft options */
draft: {
/**
* If true the element will be drawn in grey scale colors to visualize that it's only a draft.
* @type boolean
* @name JXG.GeometryElement#draft
* @default {@link JXG.Options.elements.draft#draft}
*/
draft: false,
strokeColor: '#565656',
fillColor: '#565656',
strokeOpacity: 0.8,
fillOpacity: 0.8,
strokeWidth: 1
},
/**
* @private
* By default, an element is not a label. Do not change this.
*/
isLabel: false
// close the meta tag
/**#@-*/
},
/*
* Generic options used by {@link JXG.Ticks}
*/
ticks: {
/**#@+
* @visprop
*/
/**
* A function that expects two {@link JXG.Coords}, the first one representing the coordinates of the
* tick that is to be labeled, the second one the coordinates of the center (the tick with position 0).
*
* @type function
* @name Ticks#generateLabelText
*/
generateLabelText: null,
/**
* A function that expects two {@link JXG.Coords}, the first one representing the coordinates of the
* tick that is to be labeled, the second one the coordinates of the center (the tick with position 0).
*
* @deprecated Use {@link JGX.Options@generateLabelValue}
* @type function
* @name Ticks#generateLabelValue
*/
generateLabelValue: null,
/**
* Draw labels yes/no
*
* @type Boolean
* @name Ticks#drawLabels
* @default false
*/
drawLabels: false,
label: {
},
/**
* Use the unicode character 0x2212, i.e. the HTML entity &minus; as minus sign.
* That is −1 instead of -1.
*
* @type Boolean
* @name Ticks#useUnicodeMinus
* @default true
*/
useUnicodeMinus: true,
/**
* Determine the position of the tick with value 0. 'left' means point1 of the line, 'right' means point2,
* and 'middle' is equivalent to the midpoint of the defining points. This attribute is ignored if the parent
* line is of type axis and is parallel to either the x (i.e. y = 0) or the y (i.e. x = 0) axis.
*
* @type String
* @name Ticks#anchor
* @default 'left'
*/
anchor: 'left',
/**
* Draw the zero tick, that lies at line.point1?
*
* @type Boolean
* @name Ticks#drawZero
* @default false
*/
drawZero: false,
/**
* If the distance between two ticks is too big we could insert new ticks. If insertTicks
* is <tt>true</tt>, we'll do so, otherwise we leave the distance as is.
* This option is ignored if equidistant is false. In the example below the distance between
* two ticks is given as <tt>1</tt> but because insertTicks is set to true many ticks will
* be omitted in the rendering process to keep the display clear.
*
* @type Boolean
* @name Ticks#insertTicks
* @see Ticks#equidistant
* @see Ticks#minTicksDistance
* @default false
* @example
* // Create an axis providing two coord pairs.
* var p1 = board.create('point', [0, 0]);
* var p2 = board.create('point', [50, 25]);
* var l1 = board.create('line', [p1, p2]);
* var t = board.create('ticks', [l1, 1], {
* insertTicks: true,
* majorHeight: -1,
* label: {
* offset: [4, -9]
* },
* drawLabels: true
* });
* </pre><div class="jxgbox" id="2f6fb842-40bd-4223-aa28-3e9369d2097f" style="width: 300px; height: 300px;"></div>
* <script type="text/javascript">
* (function () {
* var board = JXG.JSXGraph.initBoard('2f6fb842-40bd-4223-aa28-3e9369d2097f', {boundingbox: [-100, 70, 70, -100], showcopyright: false, shownavigation: false});
* var p1 = board.create('point', [0, 0]);
* var p2 = board.create('point', [50, 25]);
* var l1 = board.create('line', [p1, p2]);
* var t = board.create('ticks', [l1, 1], {insertTicks: true, majorHeight: -1, label: {offset: [4, -9]}, drawLabels: true});
* })();
* </script><pre>
*/
insertTicks: false,
minTicksDistance: 10,
/**
* Total height of a minor tick. If negative the full height of the board is taken.
*
* @type Number
* @name Ticks#minorHeight
* @default 4
*/
minorHeight: 4,
/**
* Total height of a major tick. If negative the full height of the board is taken.
*
* @type Number
* @name Ticks#majorHeight
* @default 10
*/
majorHeight: 10,
/**
* Decides in which direction finite ticks are visible. Possible values are either the constants
* 0=false or 1=true or a function returning 0 or 1.
*
* In case of [0,1] the tick is only visible to the right of the line. In case of
* [1,0] the tick is only visible to the left of the line.
*
* @type Array
* @name Ticks#tickEndings
* @default [1, 1]
*/
tickEndings: [1, 1],
/**
* The number of minor ticks between two major ticks.
* @type Number
* @name Ticks#minorTicks
* @default 4
*/
minorTicks: 4,
/**
* Scale the ticks but not the tick labels.
* @type Number