comparison webapp/src/main/webapp/jquery/jquery.digilib.regions.js @ 1104:415da4e4b76b

adapting button sets
author hertzhaft
date Fri, 26 Oct 2012 14:54:11 +0200
parents d8c380faa347
children 365f95a14057
comparison
equal deleted inserted replaced
1103:d8c380faa347 1104:415da4e4b76b
114 'onNewRegion' : null, 114 'onNewRegion' : null,
115 // turn any region into a clickable link to its detail view (DEPRECATED) 115 // turn any region into a clickable link to its detail view (DEPRECATED)
116 'autoZoomOnClick' : false, 116 'autoZoomOnClick' : false,
117 // css selector for area/a elements (must also be marked with class "dl-keep") 117 // css selector for area/a elements (must also be marked with class "dl-keep")
118 'areaSelector' : 'map.dl-regioncontent area, map.dl-regioncontent a', 118 'areaSelector' : 'map.dl-regioncontent area, map.dl-regioncontent a',
119 // buttonset of this plugin 119 // general buttonset of this plugin
120 'regionSet' : ['regions', 'defineregion', 'removeregion', 'removeallregions', 'regioninfo', 'findcoords', 'finddata', 'lessoptions'], 120 'regionSet' : ['regions', 'findcoords', 'finddata', 'lessoptions'],
121 // buttonset for region editing by user
122 'userRegionSet' : ['defineregion', 'removeregion', 'removeallregions', 'regioninfo'],
121 // url param for regions 123 // url param for regions
122 'rg' : null, 124 'rg' : null,
123 // array with region data 125 // array with region data
124 'regions' : null, 126 'regions' : null,
125 // region attributes to copy from HTML 127 // region attributes to copy from HTML
779 // additional buttons 781 // additional buttons
780 var installButtons = function (data) { 782 var installButtons = function (data) {
781 var settings = data.settings; 783 var settings = data.settings;
782 var mode = settings.interactionMode; 784 var mode = settings.interactionMode;
783 var buttonSettings = settings.buttonSettings[mode]; 785 var buttonSettings = settings.buttonSettings[mode];
784 // configure buttons through digilib "regionSet" option 786 var buttonSet = settings.regionSet;
785 var buttonSet = settings.regionSet || regionSet; 787 if (settings.processUserRegions) {
788 var first = buttonSet.slice(0,1);
789 var rest = buttonSet.slice(1);
790 buttonSet = first.concat(settings.userRegionSet, rest);
791 }
786 // set regionSet to [] or '' for no buttons (when showing regions only) 792 // set regionSet to [] or '' for no buttons (when showing regions only)
787 if (buttonSet.length && buttonSet.length > 0) { 793 if (buttonSet.length && buttonSet.length > 0) {
788 buttonSettings.regionSet = buttonSet; 794 buttonSettings.regionSet = buttonSet;
789 buttonSettings.buttonSets.push('regionSet'); 795 buttonSettings.buttonSets.push('regionSet');
790 } 796 }
822 // default: autoZoom to region, when clicked - DEPRECATED 828 // default: autoZoom to region, when clicked - DEPRECATED
823 if (settings.autoZoomOnClick && settings.onClickRegion == null) { 829 if (settings.autoZoomOnClick && settings.onClickRegion == null) {
824 settings.onClickRegion = zoomToRegion; 830 settings.onClickRegion = zoomToRegion;
825 } 831 }
826 // install region buttons if user defined regions are allowed 832 // install region buttons if user defined regions are allowed
827 if (settings.processUserRegions && digilib.plugins.buttons != null) { 833 if (digilib.plugins.buttons != null) {
828 installButtons(data); 834 installButtons(data);
829 } 835 }
830 }; 836 };
831 837
832 // plugin object with name and install/init methods 838 // plugin object with name and install/init methods