diff src/djol/PopupContainer.js @ 8:f0035923ff3e

добавлена библиотека для работы с openlayers 3+
author cin
date Mon, 21 Aug 2017 17:47:00 +0300
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/djol/PopupContainer.js	Mon Aug 21 17:47:00 2017 +0300
@@ -0,0 +1,60 @@
+define([       
+    "dijit/_WidgetBase",
+    "dijit/_TemplatedMixin",
+    "dijit/_WidgetsInTemplateMixin",
+    "dijit/_Container",
+    "dojo/_base/declare",
+    "dojo/Evented",
+    "dojo/dom-class",
+    "dojo/on",
+    "dojo/text!./resources/PopupContainerTemplate.html",
+    "ol"
+],
+    function (_WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin, _Container, declare, Evented, domClass, on, templateString, ol) {
+        return declare([_WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin, _Container/*, Evented*/], {
+
+            templateString: templateString,
+            
+            overlay: null,
+            
+            map : null,
+
+            constructor: function (options) {
+                options = options || {};                
+            },
+
+            postCreate: function () {
+                var me = this;                
+                this.inherited(arguments);
+                on(this.popupCloser, "click", function () {
+                    me.destroyRecursive();
+                    me.onClose();
+                });
+            },
+                        
+            show: function (widget, opts) {
+                opts = opts || "only";
+                if (widget) {
+                    widget.placeAt(this.popupContent, opts);
+                }                
+            },
+
+            hideOverlay: function () {
+                domClass.add(this.popupOverlay, "hidden")
+            },
+
+            showOverlay: function () {
+                domClass.remove(this.popupOverlay, "hidden")
+            },
+
+            destroy : function() {
+                this.map.removeOverlay(this.overlay);                
+                this.inherited(arguments);
+            },
+
+            onClose: function () {                
+                this.emit("close");
+            }
+
+        });
+    });
\ No newline at end of file