changeset 1104:415da4e4b76b

adapting button sets
author hertzhaft
date Fri, 26 Oct 2012 14:54:11 +0200
parents d8c380faa347
children ccdac39eb3da
files webapp/src/main/webapp/jquery/jquery.digilib.regions.js
diffstat 1 files changed, 11 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/webapp/src/main/webapp/jquery/jquery.digilib.regions.js	Fri Oct 26 14:17:19 2012 +0200
+++ b/webapp/src/main/webapp/jquery/jquery.digilib.regions.js	Fri Oct 26 14:54:11 2012 +0200
@@ -116,8 +116,10 @@
         'autoZoomOnClick' : false,
         // css selector for area/a elements (must also be marked with class "dl-keep")
         'areaSelector' : 'map.dl-regioncontent area, map.dl-regioncontent a',
-        // buttonset of this plugin
-        'regionSet' : ['regions', 'defineregion', 'removeregion', 'removeallregions', 'regioninfo', 'findcoords', 'finddata', 'lessoptions'],
+        // general buttonset of this plugin
+        'regionSet' : ['regions', 'findcoords', 'finddata', 'lessoptions'],
+        // buttonset for region editing by user
+        'userRegionSet' : ['defineregion', 'removeregion', 'removeallregions', 'regioninfo'],
         // url param for regions
         'rg' : null,
         // array with region data
@@ -781,8 +783,12 @@
         var settings = data.settings;
         var mode = settings.interactionMode;
         var buttonSettings = settings.buttonSettings[mode];
-        // configure buttons through digilib "regionSet" option
-        var buttonSet = settings.regionSet || regionSet; 
+        var buttonSet = settings.regionSet;
+        if (settings.processUserRegions) {
+            var first = buttonSet.slice(0,1);
+            var rest = buttonSet.slice(1);
+            buttonSet = first.concat(settings.userRegionSet, rest);
+            }
         // set regionSet to [] or '' for no buttons (when showing regions only)
         if (buttonSet.length && buttonSet.length > 0) {
             buttonSettings.regionSet = buttonSet;
@@ -824,7 +830,7 @@
             settings.onClickRegion = zoomToRegion;
         }
         // install region buttons if user defined regions are allowed
-        if (settings.processUserRegions && digilib.plugins.buttons != null) {
+        if (digilib.plugins.buttons != null) {
             installButtons(data);
         }
     };