@doubao-apps/taro-runtime 0.0.33 → 0.0.34

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.
@@ -11,10 +11,19 @@ export function createMapContext(mapId, _component) {
11
11
  }
12
12
  const { latitude, longitude } = resolvedOption;
13
13
  return runWithController(mapId, 'moveToLocation', resolvedOption, (controller) => {
14
- controller[MAP_CONTEXT_METHOD_TO_COMPONENT_METHOD.moveToLocation]({
15
- latitude,
16
- longitude
17
- });
14
+ const animationOptions = normalizeMapViewportAnimationOptions(resolvedOption);
15
+ if (animationOptions) {
16
+ controller[MAP_CONTEXT_METHOD_TO_COMPONENT_METHOD.moveToLocation]({
17
+ latitude,
18
+ longitude
19
+ }, undefined, animationOptions);
20
+ }
21
+ else {
22
+ controller[MAP_CONTEXT_METHOD_TO_COMPONENT_METHOD.moveToLocation]({
23
+ latitude,
24
+ longitude
25
+ });
26
+ }
18
27
  return undefined;
19
28
  });
20
29
  },
@@ -32,7 +41,13 @@ export function createMapContext(mapId, _component) {
32
41
  return rejectMethod('includePoints', resolvedOption, 'padding does not support non-number values');
33
42
  }
34
43
  return runWithController(mapId, 'includePoints', resolvedOption, (controller) => {
35
- controller[MAP_CONTEXT_METHOD_TO_COMPONENT_METHOD.includePoints](resolvedOption.points, padding);
44
+ const animationOptions = normalizeMapViewportAnimationOptions(resolvedOption);
45
+ if (animationOptions) {
46
+ controller[MAP_CONTEXT_METHOD_TO_COMPONENT_METHOD.includePoints](resolvedOption.points, padding, animationOptions);
47
+ }
48
+ else {
49
+ controller[MAP_CONTEXT_METHOD_TO_COMPONENT_METHOD.includePoints](resolvedOption.points, padding);
50
+ }
36
51
  return undefined;
37
52
  });
38
53
  },
@@ -121,4 +136,15 @@ function normalizeFitPointsPadding(padding) {
121
136
  // fitPoints expects left/right/top/bottom.
122
137
  return [left, right, top, bottom];
123
138
  }
139
+ function normalizeMapViewportAnimationOptions(option) {
140
+ const { animated, duration } = option;
141
+ const animationOptions = {};
142
+ if (typeof animated === 'boolean') {
143
+ animationOptions.animated = animated;
144
+ }
145
+ if (typeof duration === 'number') {
146
+ animationOptions.duration = duration;
147
+ }
148
+ return Object.keys(animationOptions).length > 0 ? animationOptions : undefined;
149
+ }
124
150
  //# sourceMappingURL=index.js.map
@@ -20,18 +20,9 @@ export function resolvePolylines(polylines) {
20
20
  : typeof item.color === 'string'
21
21
  ? [item.color]
22
22
  : undefined;
23
- // Map arrow line/icon to Doubao edgeTexture + edgeTextureAssets
24
- let edgeTexture;
25
- let edgeTextureAssets;
26
- const segmentCount = Array.isArray(item.points) ? Math.max(item.points.length - 1, 0) : 0;
27
- const arrowIconPath = item.arrowIconPath;
28
- const arrowLine = item.arrowLine;
29
- if (arrowLine && typeof arrowIconPath === 'string' && segmentCount > 0) {
30
- // Use a deterministic id per icon path
31
- const textureId = `arrow_${hashString(arrowIconPath)}`;
32
- edgeTextureAssets = [{ id: textureId, url: arrowIconPath }];
33
- edgeTexture = new Array(segmentCount).fill(textureId);
34
- }
23
+ const edgeTexture = item.edgeTexture;
24
+ const edgeTextureAssets = item
25
+ .edgeTextureAssets;
35
26
  return {
36
27
  id: String(getOptionalId(item, index)),
37
28
  points: item.points,
@@ -43,15 +34,6 @@ export function resolvePolylines(polylines) {
43
34
  };
44
35
  });
45
36
  }
46
- function hashString(s) {
47
- // Simple non-crypto hash for id stability
48
- let h = 0;
49
- for (let i = 0; i < s.length; i++) {
50
- h = (h << 5) - h + s.charCodeAt(i);
51
- h |= 0; // convert to 32-bit
52
- }
53
- return Math.abs(h).toString(36);
54
- }
55
37
  export function resolveCircles(circles) {
56
38
  return (circles ?? []).map((item, index) => ({
57
39
  id: String(getOptionalId(item, index)),
@@ -244,13 +244,13 @@ function renderDefaultMarkerContent(marker, markerId, activeCalloutMarkerId, onL
244
244
  function createMapController(options) {
245
245
  return {
246
246
  getCenter: () => getMapInstance(options.mapRef).getCenter(),
247
- setCenter: (center, scaleValue) => {
248
- getMapInstance(options.mapRef).setCenter(center, scaleValue);
247
+ setCenter: (center, scaleValue, animationOptions) => {
248
+ getMapInstance(options.mapRef).setCenter(center, scaleValue, animationOptions);
249
249
  },
250
250
  getScale: () => getMapInstance(options.mapRef).getScale(),
251
251
  getBound: () => getMapInstance(options.mapRef).getBound(),
252
- fitPoints: (points, padding) => {
253
- getMapInstance(options.mapRef).fitPoints(points, padding);
252
+ fitPoints: (points, padding, animationOptions) => {
253
+ getMapInstance(options.mapRef).fitPoints(points, padding, animationOptions);
254
254
  },
255
255
  setAnchor: (position) => {
256
256
  getMapInstance(options.mapRef).setAnchor(position);
@@ -107,6 +107,12 @@ function collectShapeWarnings(markers, polylines, circles, polygons) {
107
107
  if ((polylines ?? []).some((item) => item.borderWidth !== undefined)) {
108
108
  unsupported.push('polyline[].borderWidth');
109
109
  }
110
+ if ((polylines ?? []).some((item) => item.arrowLine !== undefined)) {
111
+ unsupported.push('polyline[].arrowLine');
112
+ }
113
+ if ((polylines ?? []).some((item) => item.arrowIconPath !== undefined)) {
114
+ unsupported.push('polyline[].arrowIconPath');
115
+ }
110
116
  if (polygons.some((item) => item.level !== undefined)) {
111
117
  unsupported.push('polygons[].level');
112
118
  }
@@ -19,6 +19,6 @@ function toCommonEvent(detail, type) {
19
19
  }
20
20
  export function WebView(props) {
21
21
  const { src, onLoad, onError, onMessage } = props;
22
- return (<web-view src={src} onLoad={() => onLoad?.(toCommonEvent({ src }, 'load'))} onError={(e) => onError?.(toCommonEvent({ src, errorMsg: e.errorMsg, errorCode: e.errorCode }, 'error'))} onMessage={(e) => onMessage?.(toCommonEvent({ data: [e.msg] }, 'message'))}/>);
22
+ return (<web-view src={src} onLoad={(e) => onLoad?.(toCommonEvent({ src: e.src }, 'load'))} onError={(e) => onError?.(toCommonEvent({ src: e.url, errorMsg: e.errorMsg, errorCode: e.errorCode }, 'error'))} onMessage={(e) => onMessage?.(toCommonEvent({ data: [e.data] }, 'message'))}/>);
23
23
  }
24
24
  //# sourceMappingURL=index.jsx.map
package/package.json CHANGED
@@ -37,7 +37,7 @@
37
37
  "access": "public",
38
38
  "registry": "https://registry.npmjs.org/"
39
39
  },
40
- "version": "0.0.33",
40
+ "version": "0.0.34",
41
41
  "scripts": {
42
42
  "dev": "npm run build -- -w",
43
43
  "build": "rimraf dist bundle && tsc -p tsconfig.build.json",