Mercurial > pub > ImplabJs
comparison src/djol/LayerCheckBox.js @ 8:f0035923ff3e
добавлена библиотека для работы с openlayers 3+
author | cin |
---|---|
date | Mon, 21 Aug 2017 17:47:00 +0300 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
7:9c0943c68a90 | 8:f0035923ff3e |
---|---|
1 define([ | |
2 "dojo/_base/declare", | |
3 "dijit/_WidgetBase", | |
4 "dijit/_TemplatedMixin", | |
5 "dijit/_WidgetsInTemplateMixin", | |
6 "dojo/text!./resources/LayerCheckBoxTemplate.html", | |
7 "dijit/form/CheckBox" ], function(declare, _WidgetBase, _TemplatedMixin, | |
8 _WidgetsInTemplateMixin, templateString) { | |
9 return declare([ _WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin ], { | |
10 templateString : templateString, | |
11 labelNode : null, | |
12 checkBox : null, | |
13 | |
14 label : "", | |
15 _setLabelAttr : { | |
16 node : "labelNode", | |
17 type : "innerHTML" | |
18 }, | |
19 | |
20 name : "layer", | |
21 | |
22 _layer : null, | |
23 | |
24 constructor : function(options) { | |
25 options = options || {}; | |
26 | |
27 if (!options.layer) | |
28 throw new Error("The layer is required"); | |
29 | |
30 this._layer = options.layer; | |
31 this.label = options.layer.get("label") || "unnamed"; | |
32 }, | |
33 | |
34 postCreate : function() { | |
35 var me = this; | |
36 me.inherited(arguments); | |
37 | |
38 me.checkBox.set('name', me.name); | |
39 me.checkBox.set('value', me._layer.getVisible()); | |
40 this.checkBox.on("change", function(value) { | |
41 me._changed(value); | |
42 }); | |
43 }, | |
44 | |
45 _changed : function(visible) { | |
46 this._layer.setVisible(visible); | |
47 } | |
48 }); | |
49 }); |