@maplat/ui 0.10.3 → 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maplat/ui",
3
- "version": "0.10.3",
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 --devtool=inline-source-map",
18
- "server:packed": "npm run freeze && webpack-cli serve --config ./webpack_config/webpack.config.packed.dev.js --mode=development --devtool=inline-source-map",
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,52 +44,52 @@
44
44
  },
45
45
  "homepage": "https://github.com/code4history/Maplat/wiki",
46
46
  "dependencies": {
47
- "@maplat/core": "^0.10.4",
48
- "@maplat/tin": "^0.9.3",
47
+ "@maplat/core": "^0.10.6",
48
+ "@maplat/tin": "^0.9.4",
49
49
  "@turf/turf": "^6.5.0",
50
- "bootstrap.native": "^3.0.15",
51
- "caniuse-lite": "^1.0.30001239",
50
+ "caniuse-lite": "^1.0.30001431",
52
51
  "lodash.template": "^4.5.0",
53
- "ol": "^6.1.1",
52
+ "ol": "^6.14.1",
54
53
  "ol-contextmenu": "^4.1.0",
55
54
  "swiper": "^6.7.1",
56
55
  "swiper4": "npm:swiper@^4.5.1",
57
56
  "weiwudi": "^0.1.4"
58
57
  },
59
58
  "devDependencies": {
60
- "@babel/cli": "^7.14.5",
61
- "@babel/core": "^7.14.6",
62
- "@babel/preset-env": "^7.14.7",
63
- "babel-jest": "^26.6.3",
64
- "babel-loader": "^8.2.2",
65
- "clean-webpack-plugin": "^3.0.0",
59
+ "@babel/cli": "^7.17.10",
60
+ "@babel/core": "^7.18.2",
61
+ "@babel/preset-env": "^7.18.2",
62
+ "babel-jest": "^28.1.0",
63
+ "babel-loader": "^8.2.5",
64
+ "clean-webpack-plugin": "^4.0.0",
66
65
  "concaveman": "https://github.com/grassick/concaveman#patch-1",
67
66
  "copy-webpack-plugin": "^6.4.1",
68
- "core-js": "^3.15.1",
67
+ "core-js": "^3.22.7",
68
+ "cross-env": "^7.0.3",
69
69
  "css-loader": "^5.2.6",
70
70
  "css-minimizer-webpack-plugin": "^4.2.2",
71
- "eslint": "^7.29.0",
72
- "eslint-config-prettier": "^7.2.0",
71
+ "eslint": "^7.32.0",
72
+ "eslint-config-prettier": "^8.5.0",
73
73
  "eslint-loader": "^4.0.2",
74
- "eslint-plugin-jest": "^24.3.6",
74
+ "eslint-plugin-jest": "^26.3.0",
75
75
  "file-loader": "^6.2.0",
76
- "fs-extra": "^8.1.0",
76
+ "fs-extra": "^10.1.0",
77
77
  "gulp": "^4.0.2",
78
78
  "gulp-cli": "^2.3.0",
79
- "gulp-zip": "^4.2.0",
80
- "html-webpack-plugin": "^4.5.2",
81
- "jest": "^26.6.3",
79
+ "gulp-zip": "^5.1.0",
80
+ "html-webpack-plugin": "^5.5.0",
81
+ "jest": "^28.1.0",
82
82
  "jest-canvas-mock": "^2.3.1",
83
- "less": "^3.13.1",
84
- "less-loader": "^7.1.0",
83
+ "less": "^4.1.2",
84
+ "less-loader": "^11.0.0",
85
85
  "lodash": "^4.17.21",
86
- "mini-css-extract-plugin": "^1.6.0",
87
- "prettier": "^2.3.1",
86
+ "mini-css-extract-plugin": "^2.6.0",
87
+ "prettier": "^2.6.2",
88
88
  "strip-whitespace-loader": "github:kochizufan/strip-whitespace-loader#fix_dq_npm",
89
- "terser-webpack-plugin": "^4.2.3",
89
+ "terser-webpack-plugin": "^5.3.1",
90
90
  "url-loader": "^4.1.1",
91
- "webpack": "^5.40.0",
92
- "webpack-cli": "^4.7.2",
91
+ "webpack": "^5.72.1",
92
+ "webpack-cli": "^4.9.2",
93
93
  "webpack-dev-server": "^4.11.1",
94
94
  "workbox-build": "^6.5.4",
95
95
  "workbox-cli": "^6.5.4",
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: ".swiper-pagination",
1475
+ el: ".poi-pagination",
1468
1476
  clickable: true
1469
1477
  },
1470
1478
  navigation: {
@@ -610,11 +610,13 @@ export class CompassRotate extends Rotate {
610
610
  center[1] != this.center_[1] ||
611
611
  zoom != this.zoom_
612
612
  ) {
613
- const contains = this.element.classList.contains("disable");
614
- if (!contains && rotation === 0) {
615
- this.element.classList.add("disable");
616
- } else if (contains && rotation !== 0) {
617
- this.element.classList.remove("disable");
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