@@ -28,8 +28,9 @@ class Main {
2828 * @param {String|Element|jQuery } container - Either a string containing the
2929 * ID of the container element, or the element itself (as a
3030 * native/jQuery object)
31+ * @param {Object } options - Overrides for default library options
3132 */
32- constructor ( container ) {
33+ constructor ( container , options = { } ) {
3334 this . config = new Config ( ) ;
3435
3536 // SVG.Doc expects either a string with the element's ID, or the element
@@ -56,22 +57,27 @@ class Main {
5657 this . links = [ ] ;
5758
5859 // Options
59- this . options = {
60- // Category of top Links to show
61- topLinksCategory : "default" ,
62- // Category of bottom Links to show
63- bottomLinksCategory : "none" ,
64-
65- // Continue to display top/bottom Links when moving Words?
66- showTopLinksOnMove : true ,
67- showBottomLinksOnMove : false ,
68-
69- // Show main/argument labels on Links?
70- showTopMainLabel : true ,
71- showTopArgLabels : false ,
72- showBottomMainLabel : true ,
73- showBottomArgLabels : false
74- } ;
60+ this . options = _ . defaults (
61+ options ,
62+
63+ // Default options
64+ {
65+ // Category of top Links to show
66+ topLinksCategory : "default" ,
67+ // Category of bottom Links to show
68+ bottomLinksCategory : "none" ,
69+
70+ // Continue to display top/bottom Links when moving Words?
71+ showTopLinksOnMove : true ,
72+ showBottomLinksOnMove : false ,
73+
74+ // Show main/argument labels on Links?
75+ showTopMainLabel : true ,
76+ showTopArgLabels : false ,
77+ showBottomMainLabel : true ,
78+ showBottomArgLabels : false
79+ }
80+ ) ;
7581
7682 // Initialisation
7783 this . resize ( ) ;
0 commit comments