@heycar/heycars-map 0.6.9 → 0.6.10
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/index.cjs +32 -2
- package/dist/index.js +32 -2
- package/dist/utils/platform.d.ts +25 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1893,6 +1893,34 @@ const useMapLoader = (props) => {
|
|
|
1893
1893
|
onChange
|
|
1894
1894
|
});
|
|
1895
1895
|
};
|
|
1896
|
+
var WEBGL_STATUS = /* @__PURE__ */ ((WEBGL_STATUS2) => {
|
|
1897
|
+
WEBGL_STATUS2["NOT_SUPPORTED"] = "NOT_SUPPORTED";
|
|
1898
|
+
WEBGL_STATUS2["DISABLED"] = "DISABLED";
|
|
1899
|
+
WEBGL_STATUS2["ENABLED"] = "ENABLED";
|
|
1900
|
+
return WEBGL_STATUS2;
|
|
1901
|
+
})(WEBGL_STATUS || {});
|
|
1902
|
+
function detectWebGL() {
|
|
1903
|
+
if (typeof window === "undefined")
|
|
1904
|
+
return "NOT_SUPPORTED";
|
|
1905
|
+
if (window.WebGLRenderingContext) {
|
|
1906
|
+
const canvas = document.createElement("canvas");
|
|
1907
|
+
const names = ["webgl", "experimental-webgl", "moz-webgl", "webkit-3d"];
|
|
1908
|
+
let context2 = null;
|
|
1909
|
+
for (const name of names) {
|
|
1910
|
+
try {
|
|
1911
|
+
context2 = canvas.getContext(name);
|
|
1912
|
+
if (context2 && typeof context2.getParameter === "function") {
|
|
1913
|
+
return "ENABLED";
|
|
1914
|
+
}
|
|
1915
|
+
} catch (e) {
|
|
1916
|
+
console.error("MyError: detectWebGL catch e = ", e);
|
|
1917
|
+
return "NOT_SUPPORTED";
|
|
1918
|
+
}
|
|
1919
|
+
}
|
|
1920
|
+
return "DISABLED";
|
|
1921
|
+
}
|
|
1922
|
+
return "NOT_SUPPORTED";
|
|
1923
|
+
}
|
|
1896
1924
|
const ZOOM_WHEEL_RATIO = -135e-5;
|
|
1897
1925
|
const useAmapWheelZoomCenter = (props) => {
|
|
1898
1926
|
const { mapRef, enableRef } = props;
|
|
@@ -1984,7 +2012,7 @@ const Amap = defineSetup(function Amap2(props, { slots, emit }) {
|
|
|
1984
2012
|
);
|
|
1985
2013
|
watchNoneImmediatePostEffectForMapProperty(mapRef, props, [
|
|
1986
2014
|
{ name: "center", defaultValue: [0, 0] },
|
|
1987
|
-
{ name: "zooms", defaultValue: [
|
|
2015
|
+
{ name: "zooms", defaultValue: [2, 20] },
|
|
1988
2016
|
{ name: "zoom", defaultValue: 0 },
|
|
1989
2017
|
{ name: "layers", defaultValue: [] },
|
|
1990
2018
|
{ name: "limitBounds", defaultValue: [] },
|
|
@@ -2134,7 +2162,6 @@ var createRuntimeFn = (config) => (options) => {
|
|
|
2134
2162
|
return className;
|
|
2135
2163
|
};
|
|
2136
2164
|
var gmap = "_7anfuo0";
|
|
2137
|
-
createRuntimeFn({ defaultClassName: "", variantClassNames: { enable: { true: "_7anfuo1", false: "_7anfuo2" } }, defaultVariants: {}, compoundVariants: [] });
|
|
2138
2165
|
const Gmap = defineSetup(function Gmap2(props, { slots, emit }) {
|
|
2139
2166
|
const setMap = props.mapRef;
|
|
2140
2167
|
const { onResize } = props;
|
|
@@ -2207,6 +2234,9 @@ const Loading = defineSetup(function Loading2() {
|
|
|
2207
2234
|
})]);
|
|
2208
2235
|
});
|
|
2209
2236
|
window.movingDraw = !new URLSearchParams(location.search).has("disableMovingDraw");
|
|
2237
|
+
if (detectWebGL() === WEBGL_STATUS.ENABLED) {
|
|
2238
|
+
window.forceWebGL = true;
|
|
2239
|
+
}
|
|
2210
2240
|
const MapProvider = defineLagecySetup(function MapProvider2(props, {
|
|
2211
2241
|
slots
|
|
2212
2242
|
}) {
|
package/dist/index.js
CHANGED
|
@@ -1891,6 +1891,34 @@ const useMapLoader = (props) => {
|
|
|
1891
1891
|
onChange
|
|
1892
1892
|
});
|
|
1893
1893
|
};
|
|
1894
|
+
var WEBGL_STATUS = /* @__PURE__ */ ((WEBGL_STATUS2) => {
|
|
1895
|
+
WEBGL_STATUS2["NOT_SUPPORTED"] = "NOT_SUPPORTED";
|
|
1896
|
+
WEBGL_STATUS2["DISABLED"] = "DISABLED";
|
|
1897
|
+
WEBGL_STATUS2["ENABLED"] = "ENABLED";
|
|
1898
|
+
return WEBGL_STATUS2;
|
|
1899
|
+
})(WEBGL_STATUS || {});
|
|
1900
|
+
function detectWebGL() {
|
|
1901
|
+
if (typeof window === "undefined")
|
|
1902
|
+
return "NOT_SUPPORTED";
|
|
1903
|
+
if (window.WebGLRenderingContext) {
|
|
1904
|
+
const canvas = document.createElement("canvas");
|
|
1905
|
+
const names = ["webgl", "experimental-webgl", "moz-webgl", "webkit-3d"];
|
|
1906
|
+
let context2 = null;
|
|
1907
|
+
for (const name of names) {
|
|
1908
|
+
try {
|
|
1909
|
+
context2 = canvas.getContext(name);
|
|
1910
|
+
if (context2 && typeof context2.getParameter === "function") {
|
|
1911
|
+
return "ENABLED";
|
|
1912
|
+
}
|
|
1913
|
+
} catch (e) {
|
|
1914
|
+
console.error("MyError: detectWebGL catch e = ", e);
|
|
1915
|
+
return "NOT_SUPPORTED";
|
|
1916
|
+
}
|
|
1917
|
+
}
|
|
1918
|
+
return "DISABLED";
|
|
1919
|
+
}
|
|
1920
|
+
return "NOT_SUPPORTED";
|
|
1921
|
+
}
|
|
1894
1922
|
const ZOOM_WHEEL_RATIO = -135e-5;
|
|
1895
1923
|
const useAmapWheelZoomCenter = (props) => {
|
|
1896
1924
|
const { mapRef, enableRef } = props;
|
|
@@ -1982,7 +2010,7 @@ const Amap = defineSetup(function Amap2(props, { slots, emit }) {
|
|
|
1982
2010
|
);
|
|
1983
2011
|
watchNoneImmediatePostEffectForMapProperty(mapRef, props, [
|
|
1984
2012
|
{ name: "center", defaultValue: [0, 0] },
|
|
1985
|
-
{ name: "zooms", defaultValue: [
|
|
2013
|
+
{ name: "zooms", defaultValue: [2, 20] },
|
|
1986
2014
|
{ name: "zoom", defaultValue: 0 },
|
|
1987
2015
|
{ name: "layers", defaultValue: [] },
|
|
1988
2016
|
{ name: "limitBounds", defaultValue: [] },
|
|
@@ -2132,7 +2160,6 @@ var createRuntimeFn = (config) => (options) => {
|
|
|
2132
2160
|
return className;
|
|
2133
2161
|
};
|
|
2134
2162
|
var gmap = "_7anfuo0";
|
|
2135
|
-
createRuntimeFn({ defaultClassName: "", variantClassNames: { enable: { true: "_7anfuo1", false: "_7anfuo2" } }, defaultVariants: {}, compoundVariants: [] });
|
|
2136
2163
|
const Gmap = defineSetup(function Gmap2(props, { slots, emit }) {
|
|
2137
2164
|
const setMap = props.mapRef;
|
|
2138
2165
|
const { onResize } = props;
|
|
@@ -2205,6 +2232,9 @@ const Loading = defineSetup(function Loading2() {
|
|
|
2205
2232
|
})]);
|
|
2206
2233
|
});
|
|
2207
2234
|
window.movingDraw = !new URLSearchParams(location.search).has("disableMovingDraw");
|
|
2235
|
+
if (detectWebGL() === WEBGL_STATUS.ENABLED) {
|
|
2236
|
+
window.forceWebGL = true;
|
|
2237
|
+
}
|
|
2208
2238
|
const MapProvider = defineLagecySetup(function MapProvider2(props, {
|
|
2209
2239
|
slots
|
|
2210
2240
|
}) {
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export declare enum BRWOSER_PLATFORM {
|
|
2
|
+
WECHAT = "WECHAT",
|
|
3
|
+
WECHAT_MINIPROGRAM = "WECHAT_MINIPROGRAM",
|
|
4
|
+
ALIPAY = "ALIPAY",
|
|
5
|
+
ALIPAY_MINIPROGRAM = "ALIPAY_MINIPROGRAM",
|
|
6
|
+
H5 = "H5",
|
|
7
|
+
NODE_JS = "NODE_JS"
|
|
8
|
+
}
|
|
9
|
+
export declare enum OS_PLATFORM {
|
|
10
|
+
IOS = "IOS",
|
|
11
|
+
ANDROID = "ANDROID",
|
|
12
|
+
OTHER = "OTHER"
|
|
13
|
+
}
|
|
14
|
+
export declare enum WEBGL_STATUS {
|
|
15
|
+
NOT_SUPPORTED = "NOT_SUPPORTED",
|
|
16
|
+
DISABLED = "DISABLED",
|
|
17
|
+
ENABLED = "ENABLED"
|
|
18
|
+
}
|
|
19
|
+
export declare const detectBrowserPlatform: () => BRWOSER_PLATFORM;
|
|
20
|
+
export declare const detectOSPlatform: () => OS_PLATFORM;
|
|
21
|
+
/**
|
|
22
|
+
* Detects if WebGL is enabled.
|
|
23
|
+
* Inspired from http://www.browserleaks.com/webgl#howto-detect-webgl
|
|
24
|
+
*/
|
|
25
|
+
export declare function detectWebGL(): WEBGL_STATUS;
|