8
|
1 define([
|
|
2 "dijit/_WidgetBase",
|
|
3 "dijit/_TemplatedMixin",
|
|
4 "dijit/_WidgetsInTemplateMixin",
|
|
5 "dijit/_Container",
|
|
6 "dojo/_base/declare",
|
|
7 "dojo/Evented",
|
|
8 "dojo/dom-class",
|
|
9 "dojo/on",
|
|
10 "dojo/text!./resources/PopupContainerTemplate.html",
|
|
11 "ol"
|
|
12 ],
|
|
13 function (_WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin, _Container, declare, Evented, domClass, on, templateString, ol) {
|
|
14 return declare([_WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin, _Container/*, Evented*/], {
|
|
15
|
|
16 templateString: templateString,
|
|
17
|
|
18 overlay: null,
|
|
19
|
|
20 map : null,
|
|
21
|
|
22 constructor: function (options) {
|
|
23 options = options || {};
|
|
24 },
|
|
25
|
|
26 postCreate: function () {
|
|
27 var me = this;
|
|
28 this.inherited(arguments);
|
|
29 on(this.popupCloser, "click", function () {
|
|
30 me.destroyRecursive();
|
|
31 me.onClose();
|
|
32 });
|
|
33 },
|
|
34
|
|
35 show: function (widget, opts) {
|
|
36 opts = opts || "only";
|
|
37 if (widget) {
|
|
38 widget.placeAt(this.popupContent, opts);
|
|
39 }
|
|
40 },
|
|
41
|
|
42 hideOverlay: function () {
|
|
43 domClass.add(this.popupOverlay, "hidden")
|
|
44 },
|
|
45
|
|
46 showOverlay: function () {
|
|
47 domClass.remove(this.popupOverlay, "hidden")
|
|
48 },
|
|
49
|
|
50 destroy : function() {
|
|
51 this.map.removeOverlay(this.overlay);
|
|
52 this.inherited(arguments);
|
|
53 },
|
|
54
|
|
55 onClose: function () {
|
|
56 this.emit("close");
|
|
57 }
|
|
58
|
|
59 });
|
|
60 }); |