changeset 1135:ad1b3ed04a55

moved deep copy of settings back to annotator plugin.
author robcast
date Fri, 16 Nov 2012 15:33:18 +0100
parents cd594aa261ec
children 95ca45086d00
files webapp/src/main/webapp/jquery/jquery.digilib.annotator.js webapp/src/main/webapp/jquery/jquery.digilib.js
diffstat 2 files changed, 8 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/webapp/src/main/webapp/jquery/jquery.digilib.annotator.js	Tue Nov 13 20:18:11 2012 +0100
+++ b/webapp/src/main/webapp/jquery/jquery.digilib.annotator.js	Fri Nov 16 15:33:18 2012 +0100
@@ -469,8 +469,9 @@
         		}
         	}
         };
-        // merge with settings
-        $.extend(true, pluginParams, data.settings.annotatorPluginSettings);
+        // merge with settings 
+        // (deep copy of local params with defaults from plugin and options from HTML)
+        $.extend(true, pluginParams, defaults.annotatorPluginSettings, data.options.annotatorPluginSettings);
         // add plugins
         $.each(settings.annotatorPlugins, function (idx, name) {
         	var params = pluginParams[name];
--- a/webapp/src/main/webapp/jquery/jquery.digilib.js	Tue Nov 13 20:18:11 2012 +0100
+++ b/webapp/src/main/webapp/jquery/jquery.digilib.js	Fri Nov 16 15:33:18 2012 +0100
@@ -125,9 +125,9 @@
                 geom = fn.geometry;
             }
             FULL_AREA  = geom.rectangle(0, 0, 1, 1);
-
             // settings for this digilib instance are merged from defaults and options
-            var settings = $.extend(true, {}, defaults, options);
+            // (no deep copy because lists would be joined)
+            var settings = $.extend({}, defaults, options);
             var isFullscreen = settings.interactionMode === 'fullscreen';
             var queryParams = {};
             if (isFullscreen) {
@@ -144,7 +144,7 @@
                 var data = $elem.data('digilib');
                 var params, elemSettings;
                 // if the plugin hasn't been initialized yet
-                if (!data) {
+                if (data == null) {
                     // merge query parameters
                     if (isFullscreen) {
                         params = queryParams;
@@ -171,6 +171,8 @@
                             $elem : $elem,
                             // let $elem have its own copy of settings
                             settings : elemSettings,
+		               		// keep options
+							options : options,
                             // and of the URL query parameters
                             queryParams : params
                     };