@maplat/ui 0.10.4 → 0.10.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/maplat.css +2 -2
- package/dist/assets/maplat.css.map +1 -1
- package/dist/assets/maplat.js +1 -1
- package/dist/assets/maplat.js.LICENSE.txt +1 -1
- package/dist/assets/maplat.js.map +1 -1
- package/dist/index.html +3 -1
- package/dist/service-worker.js +1 -1
- package/dist/service-worker.js.LICENSE.txt +1 -1
- package/dist/service-worker.js.map +1 -1
- package/package.json +7 -6
- package/src/index.js +10 -2
- package/src/maplat_control.js +29 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maplat/ui",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.5",
|
|
4
4
|
"description": "Maplat is the cool Historical Map/Illustrated Map Viewer.\nIt can transform each map coordinates with nonlinear but homeomorphic projection and makes possible that the maps can collaborate with GPS/accurate maps, without distorting original maps.",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"module": "src/index.js",
|
|
@@ -14,11 +14,11 @@
|
|
|
14
14
|
"locales/"
|
|
15
15
|
],
|
|
16
16
|
"scripts": {
|
|
17
|
-
"server": "webpack-cli serve --config ./webpack_config/webpack.config.standard.dev.js --mode=development",
|
|
18
|
-
"server:packed": "npm run freeze && webpack-cli serve --config ./webpack_config/webpack.config.packed.dev.js --mode=development",
|
|
17
|
+
"server": "cross-env NODE_OPTIONS=--openssl-legacy-provider webpack-cli serve --config ./webpack_config/webpack.config.standard.dev.js --mode=development",
|
|
18
|
+
"server:packed": "cross-env NODE_OPTIONS=--openssl-legacy-provider npm run freeze && cross-env NODE_OPTIONS=--openssl-legacy-provider webpack-cli serve --config ./webpack_config/webpack.config.packed.dev.js --mode=development",
|
|
19
19
|
"build": "npm run build:standard && npm run build:packed",
|
|
20
|
-
"build:standard": "webpack --color --progress --config ./webpack_config/webpack.config.standard.js",
|
|
21
|
-
"build:packed": "npm run freeze && webpack --config ./webpack_config/webpack.config.packed.js",
|
|
20
|
+
"build:standard": "cross-env NODE_OPTIONS=--openssl-legacy-provider webpack --color --progress --config ./webpack_config/webpack.config.standard.js",
|
|
21
|
+
"build:packed": "cross-env NODE_OPTIONS=--openssl-legacy-provider npm run freeze && cross-env NODE_OPTIONS=--openssl-legacy-provider webpack --config ./webpack_config/webpack.config.packed.js",
|
|
22
22
|
"zip": "gulp zip",
|
|
23
23
|
"test": "jest",
|
|
24
24
|
"preversion": "npm run lint",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
},
|
|
45
45
|
"homepage": "https://github.com/code4history/Maplat/wiki",
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@maplat/core": "^0.10.
|
|
47
|
+
"@maplat/core": "^0.10.6",
|
|
48
48
|
"@maplat/tin": "^0.9.4",
|
|
49
49
|
"@turf/turf": "^6.5.0",
|
|
50
50
|
"caniuse-lite": "^1.0.30001431",
|
|
@@ -65,6 +65,7 @@
|
|
|
65
65
|
"concaveman": "https://github.com/grassick/concaveman#patch-1",
|
|
66
66
|
"copy-webpack-plugin": "^6.4.1",
|
|
67
67
|
"core-js": "^3.22.7",
|
|
68
|
+
"cross-env": "^7.0.3",
|
|
68
69
|
"css-loader": "^5.2.6",
|
|
69
70
|
"css-minimizer-webpack-plugin": "^4.2.2",
|
|
70
71
|
"eslint": "^7.32.0",
|
package/src/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { absoluteUrl } from "./absolute_url";
|
|
2
2
|
import { Swiper } from "./swiper_ex";
|
|
3
|
+
import { Navigation, Pagination } from "swiper";
|
|
3
4
|
import EventTarget from "ol/events/Target";
|
|
4
5
|
import page from "../legacy/page";
|
|
5
6
|
import bsn from "../legacy/bootstrap-native";
|
|
@@ -31,6 +32,7 @@ import { NowMap } from "@maplat/core/lib/source/nowmap";
|
|
|
31
32
|
import Weiwudi from "weiwudi";
|
|
32
33
|
import { normalizeArg } from "./function";
|
|
33
34
|
import pointer from "./pointer_images";
|
|
35
|
+
Swiper.use([Navigation, Pagination]);
|
|
34
36
|
|
|
35
37
|
// Maplat UI Class
|
|
36
38
|
export class MaplatUi extends EventTarget {
|
|
@@ -187,6 +189,9 @@ export class MaplatUi extends EventTarget {
|
|
|
187
189
|
if (appOption.appEnvelope) {
|
|
188
190
|
ui.appEnvelope = true;
|
|
189
191
|
}
|
|
192
|
+
if (appOption.northTop) {
|
|
193
|
+
ui.northTop = true;
|
|
194
|
+
}
|
|
190
195
|
|
|
191
196
|
let pwaManifest = appOption.pwaManifest;
|
|
192
197
|
let pwaWorker = appOption.pwaWorker;
|
|
@@ -277,6 +282,7 @@ export class MaplatUi extends EventTarget {
|
|
|
277
282
|
<d c="poi_data hide">
|
|
278
283
|
<d c="col-xs-12 swiper-container poi_img_swiper">
|
|
279
284
|
<d c="swiper-wrapper"></d>
|
|
285
|
+
<d c="swiper-pagination poi-pagination"></d>
|
|
280
286
|
<d c="swiper-button-next poi-img-next"></d>
|
|
281
287
|
<d c="swiper-button-prev poi-img-prev"></d>
|
|
282
288
|
</d>
|
|
@@ -508,7 +514,8 @@ export class MaplatUi extends EventTarget {
|
|
|
508
514
|
tipLabel: ui.core.t("control.info", { ns: "translation" })
|
|
509
515
|
}),
|
|
510
516
|
new CompassRotate({
|
|
511
|
-
tipLabel: ui.core.t("control.compass", { ns: "translation" })
|
|
517
|
+
tipLabel: ui.core.t("control.compass", { ns: "translation" }),
|
|
518
|
+
northTop: ui.northTop
|
|
512
519
|
}),
|
|
513
520
|
new Zoom({
|
|
514
521
|
tipLabel: ui.core.t("control.zoom", { ns: "translation" })
|
|
@@ -1463,8 +1470,9 @@ enable-background="new 0 0 10 10" xml:space="preserve">
|
|
|
1463
1470
|
if (!this.poiSwiper) {
|
|
1464
1471
|
this.poiSwiper = new Swiper(".swiper-container.poi_img_swiper", {
|
|
1465
1472
|
lazy: true,
|
|
1473
|
+
modules: [Navigation, Pagination],
|
|
1466
1474
|
pagination: {
|
|
1467
|
-
el: ".
|
|
1475
|
+
el: ".poi-pagination",
|
|
1468
1476
|
clickable: true
|
|
1469
1477
|
},
|
|
1470
1478
|
navigation: {
|
package/src/maplat_control.js
CHANGED
|
@@ -610,11 +610,13 @@ export class CompassRotate extends Rotate {
|
|
|
610
610
|
center[1] != this.center_[1] ||
|
|
611
611
|
zoom != this.zoom_
|
|
612
612
|
) {
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
613
|
+
if (!this.northTop_) {
|
|
614
|
+
const contains = this.element.classList.contains("disable");
|
|
615
|
+
if (!contains && rotation === 0) {
|
|
616
|
+
this.element.classList.add("disable");
|
|
617
|
+
} else if (contains && rotation !== 0) {
|
|
618
|
+
this.element.classList.remove("disable");
|
|
619
|
+
}
|
|
618
620
|
}
|
|
619
621
|
const self = this;
|
|
620
622
|
const layer = this.getMap().getLayers().item(0);
|
|
@@ -634,6 +636,14 @@ export class CompassRotate extends Rotate {
|
|
|
634
636
|
self.label_.style.msTransform = transform;
|
|
635
637
|
self.label_.style.webkitTransform = transform;
|
|
636
638
|
self.label_.style.transform = transform;
|
|
639
|
+
if (this.northTop_) {
|
|
640
|
+
const contains = self.element.classList.contains("disable");
|
|
641
|
+
if (!contains && rot === 0) {
|
|
642
|
+
self.element.classList.add("disable");
|
|
643
|
+
} else if (contains && rot !== 0) {
|
|
644
|
+
self.element.classList.remove("disable");
|
|
645
|
+
}
|
|
646
|
+
}
|
|
637
647
|
});
|
|
638
648
|
}
|
|
639
649
|
this.rotation_ = rotation;
|
|
@@ -647,6 +657,20 @@ export class CompassRotate extends Rotate {
|
|
|
647
657
|
}
|
|
648
658
|
this.center_ = [];
|
|
649
659
|
this.zoom_ = undefined;
|
|
660
|
+
this.northTop_ = options.northTop;
|
|
661
|
+
this.callResetNorth_ = () => {
|
|
662
|
+
if (this.northTop_) {
|
|
663
|
+
const layer = this.getMap().getLayers().item(0);
|
|
664
|
+
const source = layer.getSource
|
|
665
|
+
? layer.getSource()
|
|
666
|
+
: layer.getLayers().item(0).getSource();
|
|
667
|
+
source.setViewpoint({
|
|
668
|
+
direction: 0
|
|
669
|
+
});
|
|
670
|
+
} else {
|
|
671
|
+
this.resetNorth_();
|
|
672
|
+
}
|
|
673
|
+
};
|
|
650
674
|
}
|
|
651
675
|
}
|
|
652
676
|
|