vue-openlayers-plugin 1.0.68 → 1.0.69

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.
@@ -464578,7 +464578,12 @@ class TileSuperMapRestHandler extends BaseLayer$2 {
464578
464578
  console.log(`✅ SuperMap图层 ${config.name} 瓦片加载完成`);
464579
464579
  });
464580
464580
  source.on("tileloaderror", (event) => {
464581
+ var _a4, _b3;
464582
+ const img = (_b3 = (_a4 = event == null ? void 0 : event.tile) == null ? void 0 : _a4.getImage) == null ? void 0 : _b3.call(_a4);
464583
+ const src2 = img == null ? void 0 : img.src;
464581
464584
  console.error(`❌ SuperMap图层 ${config.name} 瓦片加载失败:`, event);
464585
+ if (src2)
464586
+ console.error(`失败瓦片URL: ${src2}`);
464582
464587
  });
464583
464588
  const tileLayer = new TileLayer$2({
464584
464589
  source,
@@ -464692,8 +464697,10 @@ class TileSuperMapRestHandler extends BaseLayer$2 {
464692
464697
  const sourceOptions = {
464693
464698
  url: config.url,
464694
464699
  wrapX: true,
464695
- // SuperMap服务通常不需要wrapX
464696
- format: config.format || "webp"
464700
+ format: config.format || "webp",
464701
+ crossOrigin: config.crossOrigin || "anonymous",
464702
+ transparent: config.transparent ?? true,
464703
+ cacheEnabled: config.cacheEnabled ?? true
464697
464704
  };
464698
464705
  try {
464699
464706
  let mapJsonUrl = config.url;
@@ -464712,31 +464719,15 @@ class TileSuperMapRestHandler extends BaseLayer$2 {
464712
464719
  if (response.ok) {
464713
464720
  const mapJson = await response.json();
464714
464721
  console.log("获取到的map.json数据:", mapJson);
464715
- if (mapJson && mapJson.bounds) {
464716
- const bounds2 = mapJson.bounds;
464717
- const extent3 = [bounds2.left, bounds2.bottom, bounds2.right, bounds2.top];
464718
- const tileSize = 256;
464719
- const maxZoom = 18;
464720
- const resolutions = [];
464721
- for (let z2 = 0; z2 <= maxZoom; z2++) {
464722
- resolutions[z2] = 180 / (tileSize * Math.pow(2, z2 - 1));
464723
- }
464724
- sourceOptions.tileGrid = new TileGrid$3({
464725
- resolutions,
464726
- origin: [bounds2.left, bounds2.top]
464727
- // 使用左上角坐标
464728
- });
464729
- console.log("✅ 成功从map.json创建tileGrid配置:");
464730
- console.log("📍 Origin坐标 (左上角):", [bounds2.left, bounds2.top]);
464731
- console.log("📐 Extent范围:", extent3);
464732
- console.log("🔍 分辨率数组:", resolutions.slice(0, 5));
464733
- console.log("📏 瓦片大小:", tileSize);
464722
+ const options = TileSuperMapRest.optionsFromMapJSON(config.url, mapJson);
464723
+ if (options == null ? void 0 : options.tileGrid) {
464724
+ sourceOptions.tileGrid = options.tileGrid;
464725
+ if (options.extent)
464726
+ sourceOptions.extent = options.extent;
464727
+ console.log("✅ 使用 optionsFromMapJSON 构建 tileGrid");
464734
464728
  } else {
464735
- console.warn("map.json中没有bounds信息,使用默认配置");
464736
- const tileGrid = await this.createTileGrid(
464737
- projection2.getCode(),
464738
- config
464739
- );
464729
+ console.warn("map.json 未提供有效 tileGrid,回退到默认配置");
464730
+ const tileGrid = await this.createTileGrid(projection2.getCode(), config);
464740
464731
  if (tileGrid)
464741
464732
  sourceOptions.tileGrid = tileGrid;
464742
464733
  }
@@ -466489,6 +466480,22 @@ class LayerManager {
466489
466480
  }
466490
466481
  }
466491
466482
  }
466483
+ const projCode = view.getProjection().getCode();
466484
+ const isWorldExtent = (ext2, code) => {
466485
+ if (!ext2 || !code)
466486
+ return false;
466487
+ const [minX, minY, maxX, maxY] = ext2;
466488
+ const w2 = Math.abs(maxX - minX);
466489
+ const h2 = Math.abs(maxY - minY);
466490
+ if (code === "EPSG:4326" || code === "EPSG:4490")
466491
+ return w2 >= 359.9 && h2 >= 179.9;
466492
+ if (code === "EPSG:3857" || code === "EPSG:900913")
466493
+ return w2 >= 4e7 * 0.9 && h2 >= 4e7 * 0.9;
466494
+ return false;
466495
+ };
466496
+ if (extent3 && isWorldExtent(extent3, projCode)) {
466497
+ extent3 = null;
466498
+ }
466492
466499
  if (!extent3 || extent3.every((coord) => !isFinite(coord))) {
466493
466500
  if (config.center && Array.isArray(config.center) && config.center.length === 2) {
466494
466501
  const mapProjection = view.getProjection().getCode();
@@ -469086,6 +469093,9 @@ class MapManager {
469086
469093
  this.initManagers();
469087
469094
  this.bindMapEvents();
469088
469095
  this.emit("map-ready", this.map);
469096
+ setTimeout(() => {
469097
+ this.updateConfig(this.config);
469098
+ }, 0);
469089
469099
  return this.map;
469090
469100
  }
469091
469101
  /**
@@ -470770,7 +470780,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
470770
470780
  createElementVNode("div", {
470771
470781
  ref_key: "headerRef",
470772
470782
  ref: headerRef,
470773
- class: normalizeClass(["flex items-center justify-between px-5 py-4 border-b border-gray-200 bg-gray-50", { "cursor-move": _ctx.draggable && !isFullscreen.value }]),
470783
+ class: normalizeClass(["header flex items-center justify-between px-5 py-4 border-b border-gray-200 bg-gray-50", { "cursor-move": _ctx.draggable && !isFullscreen.value }]),
470774
470784
  onMousedown: startDrag
470775
470785
  }, [
470776
470786
  createElementVNode("div", _hoisted_6$f, [
@@ -491445,7 +491455,7 @@ function(t3) {
491445
491455
  */
491446
491456
  function(t3) {
491447
491457
  function e8() {
491448
- return (n.canvg ? Promise.resolve(n.canvg) : import("./index.es-9fec9ea8.mjs")).catch(function(t4) {
491458
+ return (n.canvg ? Promise.resolve(n.canvg) : import("./index.es-09c58559.mjs")).catch(function(t4) {
491449
491459
  return Promise.reject(new Error("Could not load canvg: " + t4));
491450
491460
  }).then(function(t4) {
491451
491461
  return t4.default ? t4.default : t4;
@@ -1,4 +1,4 @@
1
- import { c as commonjsGlobal, R as RGBColor, r as requestAnimationFrame, _ as _asyncToGenerator, a as _, p as processCanvasRGBA, b as _defineProperty } from "./index-022dd5b2.mjs";
1
+ import { c as commonjsGlobal, R as RGBColor, r as requestAnimationFrame, _ as _asyncToGenerator, a as _, p as processCanvasRGBA, b as _defineProperty } from "./index-b61cd0bb.mjs";
2
2
  import "vue";
3
3
  import "ol";
4
4
  var check = function(it) {
package/lib/index.esm.js CHANGED
@@ -1,4 +1,4 @@
1
- import { A, B, e, d, D, a2, a3, w, z, a7, a6, I, H, Z, $, L, J, K, a4, j, M, a0, a1, X, Y, U, W, Q, S, P, C, F, G, N, O, a8, f, T, E, V, y, k, q, u, g, m, h, x, s, n, o, a5, i, t, l, v } from "./index-022dd5b2.mjs";
1
+ import { A, B, e, d, D, a2, a3, w, z, a7, a6, I, H, Z, $, L, J, K, a4, j, M, a0, a1, X, Y, U, W, Q, S, P, C, F, G, N, O, a8, f, T, E, V, y, k, q, u, g, m, h, x, s, n, o, a5, i, t, l, v } from "./index-b61cd0bb.mjs";
2
2
  import "vue";
3
3
  import "ol";
4
4
  export {
package/lib/index.umd.js CHANGED
@@ -465354,7 +465354,12 @@ ${this.attributes_.map(
465354
465354
  console.log(`✅ SuperMap图层 ${config.name} 瓦片加载完成`);
465355
465355
  });
465356
465356
  source.on("tileloaderror", (event) => {
465357
+ var _a4, _b3;
465358
+ const img = (_b3 = (_a4 = event == null ? void 0 : event.tile) == null ? void 0 : _a4.getImage) == null ? void 0 : _b3.call(_a4);
465359
+ const src2 = img == null ? void 0 : img.src;
465357
465360
  console.error(`❌ SuperMap图层 ${config.name} 瓦片加载失败:`, event);
465361
+ if (src2)
465362
+ console.error(`失败瓦片URL: ${src2}`);
465358
465363
  });
465359
465364
  const tileLayer = new TileLayer$2({
465360
465365
  source,
@@ -465468,8 +465473,10 @@ ${this.attributes_.map(
465468
465473
  const sourceOptions = {
465469
465474
  url: config.url,
465470
465475
  wrapX: true,
465471
- // SuperMap服务通常不需要wrapX
465472
- format: config.format || "webp"
465476
+ format: config.format || "webp",
465477
+ crossOrigin: config.crossOrigin || "anonymous",
465478
+ transparent: config.transparent ?? true,
465479
+ cacheEnabled: config.cacheEnabled ?? true
465473
465480
  };
465474
465481
  try {
465475
465482
  let mapJsonUrl = config.url;
@@ -465488,31 +465495,15 @@ ${this.attributes_.map(
465488
465495
  if (response.ok) {
465489
465496
  const mapJson = await response.json();
465490
465497
  console.log("获取到的map.json数据:", mapJson);
465491
- if (mapJson && mapJson.bounds) {
465492
- const bounds2 = mapJson.bounds;
465493
- const extent3 = [bounds2.left, bounds2.bottom, bounds2.right, bounds2.top];
465494
- const tileSize = 256;
465495
- const maxZoom = 18;
465496
- const resolutions = [];
465497
- for (let z2 = 0; z2 <= maxZoom; z2++) {
465498
- resolutions[z2] = 180 / (tileSize * Math.pow(2, z2 - 1));
465499
- }
465500
- sourceOptions.tileGrid = new TileGrid$3({
465501
- resolutions,
465502
- origin: [bounds2.left, bounds2.top]
465503
- // 使用左上角坐标
465504
- });
465505
- console.log("✅ 成功从map.json创建tileGrid配置:");
465506
- console.log("📍 Origin坐标 (左上角):", [bounds2.left, bounds2.top]);
465507
- console.log("📐 Extent范围:", extent3);
465508
- console.log("🔍 分辨率数组:", resolutions.slice(0, 5));
465509
- console.log("📏 瓦片大小:", tileSize);
465498
+ const options = TileSuperMapRest.optionsFromMapJSON(config.url, mapJson);
465499
+ if (options == null ? void 0 : options.tileGrid) {
465500
+ sourceOptions.tileGrid = options.tileGrid;
465501
+ if (options.extent)
465502
+ sourceOptions.extent = options.extent;
465503
+ console.log("✅ 使用 optionsFromMapJSON 构建 tileGrid");
465510
465504
  } else {
465511
- console.warn("map.json中没有bounds信息,使用默认配置");
465512
- const tileGrid = await this.createTileGrid(
465513
- projection2.getCode(),
465514
- config
465515
- );
465505
+ console.warn("map.json 未提供有效 tileGrid,回退到默认配置");
465506
+ const tileGrid = await this.createTileGrid(projection2.getCode(), config);
465516
465507
  if (tileGrid)
465517
465508
  sourceOptions.tileGrid = tileGrid;
465518
465509
  }
@@ -467265,6 +467256,22 @@ ${this.attributes_.map(
467265
467256
  }
467266
467257
  }
467267
467258
  }
467259
+ const projCode = view.getProjection().getCode();
467260
+ const isWorldExtent = (ext2, code) => {
467261
+ if (!ext2 || !code)
467262
+ return false;
467263
+ const [minX, minY, maxX, maxY] = ext2;
467264
+ const w2 = Math.abs(maxX - minX);
467265
+ const h2 = Math.abs(maxY - minY);
467266
+ if (code === "EPSG:4326" || code === "EPSG:4490")
467267
+ return w2 >= 359.9 && h2 >= 179.9;
467268
+ if (code === "EPSG:3857" || code === "EPSG:900913")
467269
+ return w2 >= 4e7 * 0.9 && h2 >= 4e7 * 0.9;
467270
+ return false;
467271
+ };
467272
+ if (extent3 && isWorldExtent(extent3, projCode)) {
467273
+ extent3 = null;
467274
+ }
467268
467275
  if (!extent3 || extent3.every((coord) => !isFinite(coord))) {
467269
467276
  if (config.center && Array.isArray(config.center) && config.center.length === 2) {
467270
467277
  const mapProjection = view.getProjection().getCode();
@@ -469866,6 +469873,9 @@ ${this.attributes_.map(
469866
469873
  this.initManagers();
469867
469874
  this.bindMapEvents();
469868
469875
  this.emit("map-ready", this.map);
469876
+ setTimeout(() => {
469877
+ this.updateConfig(this.config);
469878
+ }, 0);
469869
469879
  return this.map;
469870
469880
  }
469871
469881
  /**
@@ -471551,7 +471561,7 @@ ${this.attributes_.map(
471551
471561
  vue.createElementVNode("div", {
471552
471562
  ref_key: "headerRef",
471553
471563
  ref: headerRef,
471554
- class: vue.normalizeClass(["flex items-center justify-between px-5 py-4 border-b border-gray-200 bg-gray-50", { "cursor-move": _ctx.draggable && !isFullscreen.value }]),
471564
+ class: vue.normalizeClass(["header flex items-center justify-between px-5 py-4 border-b border-gray-200 bg-gray-50", { "cursor-move": _ctx.draggable && !isFullscreen.value }]),
471555
471565
  onMousedown: startDrag
471556
471566
  }, [
471557
471567
  vue.createElementVNode("div", _hoisted_6$f, [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue-openlayers-plugin",
3
- "version": "1.0.68",
3
+ "version": "1.0.69",
4
4
  "description": "A Vue 3 plugin for OpenLayers with custom components and utilities",
5
5
  "main": "lib/index.umd.js",
6
6
  "module": "lib/index.esm.js",