@fleet-frontend/mower-maps 0.2.5-beta.17 → 0.2.5-beta.18
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.esm.js
CHANGED
|
@@ -30175,7 +30175,7 @@ MowerMapRenderer.displayName = 'MowerMapRenderer';
|
|
|
30175
30175
|
|
|
30176
30176
|
// 默认配置
|
|
30177
30177
|
const defaultMapConfig = DEFAULT_STYLES;
|
|
30178
|
-
const BoundarySvgRender = React__default.memo(({ mapJson, unStructMapData, id, maxWidth = 300, mapConfig, sn }) => {
|
|
30178
|
+
const BoundarySvgRender = React__default.memo(({ mapJson, unStructMapData, id, maxWidth = 300, maxHeight, boundaryPadding = 50, mapConfig, sn }) => {
|
|
30179
30179
|
// 合并配置
|
|
30180
30180
|
const mergedMapConfig = useMemo(() => {
|
|
30181
30181
|
return merge$1(defaultMapConfig, mapConfig);
|
|
@@ -30221,7 +30221,7 @@ const BoundarySvgRender = React__default.memo(({ mapJson, unStructMapData, id, m
|
|
|
30221
30221
|
maxY = Math.max(maxY, point[1]);
|
|
30222
30222
|
});
|
|
30223
30223
|
// 添加边距
|
|
30224
|
-
const padding =
|
|
30224
|
+
const padding = boundaryPadding;
|
|
30225
30225
|
const width = maxX - minX + padding * 2;
|
|
30226
30226
|
const height = maxY - minY + padding * 2;
|
|
30227
30227
|
return {
|
|
@@ -30230,7 +30230,7 @@ const BoundarySvgRender = React__default.memo(({ mapJson, unStructMapData, id, m
|
|
|
30230
30230
|
width,
|
|
30231
30231
|
height,
|
|
30232
30232
|
};
|
|
30233
|
-
}, [boundaryInfo]);
|
|
30233
|
+
}, [boundaryInfo, boundaryPadding]);
|
|
30234
30234
|
const commonValue = useMemo(() => {
|
|
30235
30235
|
return {
|
|
30236
30236
|
sn,
|
|
@@ -30238,17 +30238,31 @@ const BoundarySvgRender = React__default.memo(({ mapJson, unStructMapData, id, m
|
|
|
30238
30238
|
};
|
|
30239
30239
|
}, [sn, boundaryViewBox]);
|
|
30240
30240
|
const style = useMemo(() => {
|
|
30241
|
-
if (
|
|
30241
|
+
if (!maxHeight) {
|
|
30242
|
+
if (boundaryViewBox?.width > boundaryViewBox?.height) {
|
|
30243
|
+
return {
|
|
30244
|
+
width: maxWidth,
|
|
30245
|
+
height: maxWidth * (boundaryViewBox.height / boundaryViewBox.width),
|
|
30246
|
+
};
|
|
30247
|
+
}
|
|
30248
|
+
return {
|
|
30249
|
+
width: maxWidth * (boundaryViewBox.width / boundaryViewBox.height),
|
|
30250
|
+
height: maxWidth,
|
|
30251
|
+
};
|
|
30252
|
+
}
|
|
30253
|
+
const ratio = maxWidth / maxHeight;
|
|
30254
|
+
const boundaryRatio = boundaryViewBox.width / boundaryViewBox.height;
|
|
30255
|
+
if (ratio > boundaryRatio) {
|
|
30242
30256
|
return {
|
|
30243
|
-
width:
|
|
30244
|
-
height:
|
|
30257
|
+
width: Math.floor(maxHeight * boundaryRatio),
|
|
30258
|
+
height: maxHeight,
|
|
30245
30259
|
};
|
|
30246
30260
|
}
|
|
30247
30261
|
return {
|
|
30248
|
-
width: maxWidth
|
|
30249
|
-
height: maxWidth,
|
|
30262
|
+
width: maxWidth,
|
|
30263
|
+
height: Math.floor(maxWidth / boundaryRatio),
|
|
30250
30264
|
};
|
|
30251
|
-
}, [boundaryViewBox, maxWidth]);
|
|
30265
|
+
}, [boundaryViewBox, maxWidth, maxHeight]);
|
|
30252
30266
|
return (jsx(CommonContextProvider, { value: commonValue, children: jsx(SvgEditContextProvider, { value: svgEditValue, children: jsxs("div", { style: {
|
|
30253
30267
|
position: 'relative',
|
|
30254
30268
|
width: style.width,
|
package/dist/index.js
CHANGED
|
@@ -30195,7 +30195,7 @@ MowerMapRenderer.displayName = 'MowerMapRenderer';
|
|
|
30195
30195
|
|
|
30196
30196
|
// 默认配置
|
|
30197
30197
|
const defaultMapConfig = DEFAULT_STYLES;
|
|
30198
|
-
const BoundarySvgRender = React.memo(({ mapJson, unStructMapData, id, maxWidth = 300, mapConfig, sn }) => {
|
|
30198
|
+
const BoundarySvgRender = React.memo(({ mapJson, unStructMapData, id, maxWidth = 300, maxHeight, boundaryPadding = 50, mapConfig, sn }) => {
|
|
30199
30199
|
// 合并配置
|
|
30200
30200
|
const mergedMapConfig = React.useMemo(() => {
|
|
30201
30201
|
return merge$1(defaultMapConfig, mapConfig);
|
|
@@ -30241,7 +30241,7 @@ const BoundarySvgRender = React.memo(({ mapJson, unStructMapData, id, maxWidth =
|
|
|
30241
30241
|
maxY = Math.max(maxY, point[1]);
|
|
30242
30242
|
});
|
|
30243
30243
|
// 添加边距
|
|
30244
|
-
const padding =
|
|
30244
|
+
const padding = boundaryPadding;
|
|
30245
30245
|
const width = maxX - minX + padding * 2;
|
|
30246
30246
|
const height = maxY - minY + padding * 2;
|
|
30247
30247
|
return {
|
|
@@ -30250,7 +30250,7 @@ const BoundarySvgRender = React.memo(({ mapJson, unStructMapData, id, maxWidth =
|
|
|
30250
30250
|
width,
|
|
30251
30251
|
height,
|
|
30252
30252
|
};
|
|
30253
|
-
}, [boundaryInfo]);
|
|
30253
|
+
}, [boundaryInfo, boundaryPadding]);
|
|
30254
30254
|
const commonValue = React.useMemo(() => {
|
|
30255
30255
|
return {
|
|
30256
30256
|
sn,
|
|
@@ -30258,17 +30258,31 @@ const BoundarySvgRender = React.memo(({ mapJson, unStructMapData, id, maxWidth =
|
|
|
30258
30258
|
};
|
|
30259
30259
|
}, [sn, boundaryViewBox]);
|
|
30260
30260
|
const style = React.useMemo(() => {
|
|
30261
|
-
if (
|
|
30261
|
+
if (!maxHeight) {
|
|
30262
|
+
if (boundaryViewBox?.width > boundaryViewBox?.height) {
|
|
30263
|
+
return {
|
|
30264
|
+
width: maxWidth,
|
|
30265
|
+
height: maxWidth * (boundaryViewBox.height / boundaryViewBox.width),
|
|
30266
|
+
};
|
|
30267
|
+
}
|
|
30268
|
+
return {
|
|
30269
|
+
width: maxWidth * (boundaryViewBox.width / boundaryViewBox.height),
|
|
30270
|
+
height: maxWidth,
|
|
30271
|
+
};
|
|
30272
|
+
}
|
|
30273
|
+
const ratio = maxWidth / maxHeight;
|
|
30274
|
+
const boundaryRatio = boundaryViewBox.width / boundaryViewBox.height;
|
|
30275
|
+
if (ratio > boundaryRatio) {
|
|
30262
30276
|
return {
|
|
30263
|
-
width:
|
|
30264
|
-
height:
|
|
30277
|
+
width: Math.floor(maxHeight * boundaryRatio),
|
|
30278
|
+
height: maxHeight,
|
|
30265
30279
|
};
|
|
30266
30280
|
}
|
|
30267
30281
|
return {
|
|
30268
|
-
width: maxWidth
|
|
30269
|
-
height: maxWidth,
|
|
30282
|
+
width: maxWidth,
|
|
30283
|
+
height: Math.floor(maxWidth / boundaryRatio),
|
|
30270
30284
|
};
|
|
30271
|
-
}, [boundaryViewBox, maxWidth]);
|
|
30285
|
+
}, [boundaryViewBox, maxWidth, maxHeight]);
|
|
30272
30286
|
return (jsxRuntime.jsx(CommonContextProvider, { value: commonValue, children: jsxRuntime.jsx(SvgEditContextProvider, { value: svgEditValue, children: jsxRuntime.jsxs("div", { style: {
|
|
30273
30287
|
position: 'relative',
|
|
30274
30288
|
width: style.width,
|
|
@@ -6,9 +6,11 @@ interface BoundarySvgRenderProps {
|
|
|
6
6
|
unStructMapData: UnstructMapData;
|
|
7
7
|
id: number;
|
|
8
8
|
maxWidth?: number;
|
|
9
|
+
maxHeight?: number;
|
|
10
|
+
boundaryPadding?: number;
|
|
9
11
|
mapConfig?: MapConfig;
|
|
10
12
|
sn?: string;
|
|
11
13
|
}
|
|
12
|
-
declare const BoundarySvgRender: React.MemoExoticComponent<({ mapJson, unStructMapData, id, maxWidth, mapConfig, sn }: BoundarySvgRenderProps) => import("react/jsx-runtime").JSX.Element>;
|
|
14
|
+
declare const BoundarySvgRender: React.MemoExoticComponent<({ mapJson, unStructMapData, id, maxWidth, maxHeight, boundaryPadding, mapConfig, sn }: BoundarySvgRenderProps) => import("react/jsx-runtime").JSX.Element>;
|
|
13
15
|
export default BoundarySvgRender;
|
|
14
16
|
//# sourceMappingURL=BoundarySvgRender.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BoundarySvgRender.d.ts","sourceRoot":"","sources":["../../src/render/BoundarySvgRender.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAK9C,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAM3C,UAAU,sBAAsB;IAC9B,OAAO,EAAE,OAAO,CAAC;IACjB,eAAe,EAAE,eAAe,CAAC;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAID,QAAA,MAAM,iBAAiB,
|
|
1
|
+
{"version":3,"file":"BoundarySvgRender.d.ts","sourceRoot":"","sources":["../../src/render/BoundarySvgRender.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAK9C,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAM3C,UAAU,sBAAsB;IAC9B,OAAO,EAAE,OAAO,CAAC;IACjB,eAAe,EAAE,eAAe,CAAC;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAID,QAAA,MAAM,iBAAiB,oHAC8E,sBAAsB,6CA4I1H,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|