-
-
Notifications
You must be signed in to change notification settings - Fork 47
Expand file tree
/
Copy pathMapLoading.js
More file actions
72 lines (59 loc) · 2.14 KB
/
MapLoading.js
File metadata and controls
72 lines (59 loc) · 2.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
define([
'dojo/_base/declare',
'dijit/_WidgetBase',
'dojo/_base/lang',
'dojo/on',
'dojo/dom-style',
'dojo/topic',
'put-selector/put'
], function (
declare,
_WidgetBase,
lang,
on,
domStyle,
topic,
put
) {
return declare([_WidgetBase], {
className: 'fas fa-spinner fa-spin',
style: 'color:#333;text-shadow:2px 2px #eee;font-size:32px;display:none;position:absolute;top:calc(50% - 16px);left:calc(50% - 16px);z-index:999',
textStyle: 'color:#333;text-shadow:2px 2px #eee;font-size:32px;display:none;position:absolute;top:calc(50% - 16px);left:calc(50% + 20px);z-index:999',
theText: '',
postCreate: function () {
this.inherited(arguments);
this.loading = put(this.map.root, 'i', {
className: this.className,
style: this.style
});
this.theText = this.msgText || {};
if (this.theText.length > 0) {
this.loadingText = put(this.map.root, 'i', {
className: '',
style: this.textStyle,
textContent: this.theText
});
}
on(this.map, 'update-start', lang.hitch(this, 'showLoading'));
on(this.map, 'update-end', lang.hitch(this, 'hideLoading'));
topic.subscribe('showLoading/showLoading', lang.hitch(this, 'showLoading'));
topic.subscribe('showLoading/hideLoading', lang.hitch(this, 'hideLoading'));
},
showLoading: function () {
domStyle.set(this.loading, 'display', 'block');
if (this.theText.length > 0) {
domStyle.set(this.loadingText, 'display', 'block');
}
this.map.disableMapNavigation();
this.map.hideZoomSlider();
},
hideLoading: function () {
domStyle.set(this.loading, 'display', 'none');
if (this.theText.length > 0) {
domStyle.set(this.loadingText, 'display', 'none');
}
this.map.enableMapNavigation();
this.map.showZoomSlider();
}
});
});