|
6 | 6 | (function () {
|
7 | 7 | /**constructor function**/
|
8 | 8 | function MobileController() {
|
9 |
| - this._isMobile = this.isMobile(); |
| 9 | +// this._isMobile = this.isMobile(); |
| 10 | + this._isMobile = true; |
10 | 11 |
|
11 | 12 | // GPS functionalities, including geolocation and device orientation
|
12 | 13 | this._gpsController = new GPSController(this._isMobile);
|
13 | 14 |
|
| 15 | + // Watch for changes in visibility of iframe to hide/show uiMenu |
| 16 | + this._hiddenInfoboxClassName = "cesium-infoBox-bodyless"; |
| 17 | + this._visibleInfoboxClassName = "cesium-infoBox-visible"; |
| 18 | + this._oldIframeVisibility = this._visibleInfoboxClassName; |
| 19 | + this.watchInfoboxVisibility(); |
| 20 | + |
14 | 21 | this.hideCredits();
|
15 | 22 | this.hideInspector();
|
16 | 23 |
|
17 | 24 | this.setInfoboxFullscreen();
|
| 25 | + this.setToolboxFullscreen(); |
18 | 26 | }
|
19 | 27 |
|
20 | 28 | Object.defineProperties(MobileController.prototype, {
|
|
25 | 33 | set: function (value) {
|
26 | 34 | this._isMobile = value;
|
27 | 35 | }
|
| 36 | + }, |
| 37 | + gpsController: { |
| 38 | + get: function () { |
| 39 | + return this._gpsController; |
| 40 | + }, |
| 41 | + set: function (value) { |
| 42 | + this._gpsController = value; |
| 43 | + } |
| 44 | + }, |
| 45 | + oldIframeVisibility: { |
| 46 | + get: function () { |
| 47 | + return this._oldIframeVisibility; |
| 48 | + }, |
| 49 | + set: function (value) { |
| 50 | + this._oldIframeVisibility = value; |
| 51 | + } |
| 52 | + }, |
| 53 | + hiddenInfoboxClassName: { |
| 54 | + get: function () { |
| 55 | + return this._hiddenInfoboxClassName; |
| 56 | + }, |
| 57 | + set: function (value) { |
| 58 | + this._hiddenInfoboxClassName = value; |
| 59 | + } |
| 60 | + }, |
| 61 | + visibleInfoboxClassName: { |
| 62 | + get: function () { |
| 63 | + return this._visibleInfoboxClassName; |
| 64 | + }, |
| 65 | + set: function (value) { |
| 66 | + this._visibleInfoboxClassName = value; |
| 67 | + } |
28 | 68 | }
|
29 | 69 | });
|
30 | 70 |
|
|
73 | 113 | }
|
74 | 114 | }
|
75 | 115 |
|
| 116 | + /** |
| 117 | + * Automatically hide toolbox/uiMenu when an infox is shown in fullscreen. |
| 118 | + * |
| 119 | + * @returns {undefined} |
| 120 | + */ |
| 121 | + MobileController.prototype.watchInfoboxVisibility = function () { |
| 122 | + var scope = this; |
| 123 | + |
| 124 | + window.setInterval(function () { |
| 125 | + var infobox = document.getElementsByClassName('infobox-full')[0]; |
| 126 | + var uiMenu = document.getElementById('uiMenu'); |
| 127 | + |
| 128 | + for (var i = 0; i < infobox.classList.length; i++) { |
| 129 | + if (infobox.classList[i] === "cesium-infoBox-visible") { |
| 130 | + if (scope._oldIframeVisibility === "cesium-infoBox-bodyless") { |
| 131 | + uiMenu.style.display = "none"; |
| 132 | + scope._oldIframeVisibility = "cesium-infoBox-visible"; |
| 133 | + break; |
| 134 | + } |
| 135 | + } |
| 136 | + |
| 137 | + if (infobox.classList[i] === "cesium-infoBox-bodyless") { |
| 138 | + if (scope._oldIframeVisibility === "cesium-infoBox-visible") { |
| 139 | + uiMenu.style.display = "block"; |
| 140 | + scope._oldIframeVisibility = "cesium-infoBox-bodyless"; |
| 141 | + break; |
| 142 | + } |
| 143 | + } |
| 144 | + } |
| 145 | + }, 200); |
| 146 | + } |
| 147 | + |
76 | 148 | /**
|
77 | 149 | * Set infobox containing thematic values to fullscreen on mobile devices.
|
78 | 150 | *
|
|
83 | 155 |
|
84 | 156 | if (scope._isMobile) {
|
85 | 157 | var infobox = document.getElementsByClassName('cesium-infoBox')[0];
|
86 |
| - infobox.classList.add("full"); |
| 158 | + infobox.classList.add("infobox-full"); |
| 159 | + if (scope.getMobileOS() === "iOS") { |
| 160 | + infobox.classList.add("infobox-full-ios"); |
| 161 | + } |
| 162 | + } |
| 163 | + } |
| 164 | + |
| 165 | + /** |
| 166 | + * Set toolbox to fullscreen on mobile devices. |
| 167 | + * |
| 168 | + * @returns {undefined} |
| 169 | + */ |
| 170 | + MobileController.prototype.setToolboxFullscreen = function () { |
| 171 | + var scope = this; |
| 172 | + |
| 173 | + if (scope._isMobile) { |
| 174 | + var uiMenu = document.getElementById('uiMenu-content'); |
| 175 | + uiMenu.style.display = "block"; |
| 176 | + uiMenu.classList.add("uiMenu-full"); |
87 | 177 | if (scope.getMobileOS() === "iOS") {
|
88 |
| - infobox.classList.add("full-ios"); |
| 178 | + uiMenu.classList.add("uiMenu-full-ios"); |
89 | 179 | }
|
90 | 180 |
|
91 |
| - document.getElementById("uiMenu").style.display = "none"; |
92 |
| - document.getElementsByClassName('cesium-infoBox-close')[0].onclick = function () { |
93 |
| - document.getElementById("uiMenu").style.display = "block"; |
94 |
| - }; |
| 181 | + var toolbox = document.getElementById('citydb_toolbox'); |
| 182 | + toolbox.classList.add("toolbox-full"); |
| 183 | + |
| 184 | +// var long_containers = document.getElementsByClassName('citydb_long_container'); |
| 185 | +// for (var i = 0; i < long_containers.length; i++) { |
| 186 | +// long_containers[i].classList.add("citydb_long_container-full"); |
| 187 | +// } |
| 188 | + |
| 189 | +// var short_containers = document.getElementsByClassName('citydb_short_container'); |
| 190 | +// for (var i = 0; i < short_containers.length; i++) { |
| 191 | +// short_containers[i].classList.add("citydb_short_container-full"); |
| 192 | +// } |
95 | 193 | }
|
96 | 194 | }
|
97 | 195 |
|
|
0 commit comments