diff client/digitallibrary/jquery/jquery.digilib.geometry.js @ 786:912519475259 jquery

documentation for new plugin api in jquery-digilib-plugin.txt. more steps towards plugification of birdseye view.
author robcast
date Fri, 18 Feb 2011 15:16:30 +0100
parents 29de7131a5a8
children ac1d6b056a6f
line wrap: on
line diff
--- a/client/digitallibrary/jquery/jquery.digilib.geometry.js	Fri Feb 18 10:39:40 2011 +0100
+++ b/client/digitallibrary/jquery/jquery.digilib.geometry.js	Fri Feb 18 15:16:30 2011 +0100
@@ -475,17 +475,33 @@
     };
 
     // export constructor functions to digilib plugin
-    var init = function () {
-        return {
+    var geometry = {
             size : size,
             position : position,
             rectangle : rectangle,
             transform : transform
-        };
+    };
+    // install function called by digilib on plugin object
+    var install = function() {
+        // add constructor object to fn
+        this.fn.geometry = geometry;
     };
+    // digilib plugin object
+    var plugin = {
+            name : 'geometry',
+            install : install,
+            fn : {},
+            // TODO: remove old init
+            init : init
+    };
+    // TODO: remove old version of init returning contructor
+    var init = function () {
+        return geometry;
+    };
+    // plug into digilib
     if ($.fn.digilib == null) {
         $.error("jquery.digilib.geometry must be loaded after jquery.digilib!");
     } else {
-        $.fn.digilib('plugin', {name : 'geometry', init : init});
+        $.fn.digilib('plugin', plugin);
     }
 })(jQuery);