|
@@ -4,7 +4,6 @@ import { validNum } from "@/utils/shared";
|
|
|
import { aiIconMap, iconGroups } from "../constant";
|
|
|
import { Euler, MathUtils, Object3D, Quaternion, Vector3 } from "three";
|
|
|
import { getSvgContent, parseSvgContent } from "@/utils/resource";
|
|
|
-import { getIconStyle } from "@/core/components/icon";
|
|
|
|
|
|
export enum SCENE_TYPE {
|
|
|
fuse = "fuse",
|
|
@@ -339,25 +338,33 @@ export const taggingGets = {
|
|
|
: `./icons/${icon ? icon : "circle"}.svg`,
|
|
|
name,
|
|
|
pixel: true,
|
|
|
+ fixed: false,
|
|
|
size,
|
|
|
subgroup,
|
|
|
};
|
|
|
if (isWall) {
|
|
|
const wh = Math.max(item.size.width, item.size.height);
|
|
|
- if (wh === item.size.width) {
|
|
|
- item.position.y -= wh / 2;
|
|
|
- } else {
|
|
|
- item.rotate = Math.PI / 2;
|
|
|
- loadPromises.push(
|
|
|
- getIconStyle(item.url, wh, wh).then((style) => {
|
|
|
- item.position.x += style.height / 2;
|
|
|
- }).catch(() => {})
|
|
|
- );
|
|
|
- }
|
|
|
- item.size.width = wh;
|
|
|
- item.size.height = wh;
|
|
|
+ loadPromises.push(
|
|
|
+ getSvgContent(item.url).then((svgContent) => {
|
|
|
+ const content = parseSvgContent(svgContent);
|
|
|
+ item.fixed = true
|
|
|
+ // item.size.width = item.size.height = wh
|
|
|
+ if (wh === item.size.width) {
|
|
|
+ item.size.width = wh
|
|
|
+ item.size.height = data.imageWidth / data.imageHeight * (content.height / content.width * wh)
|
|
|
+ item.position.y -= item.size.height / 2;
|
|
|
+ } else {
|
|
|
+ item.size.height = wh
|
|
|
+ item.size.width = data.imageHeight / data.imageWidth * (content.width / content.height * wh)
|
|
|
+ item.position.x += item.size.height / 2;
|
|
|
+ item.rotate = Math.PI / 2;
|
|
|
+ }
|
|
|
+ tags.push(item as any);
|
|
|
+ }).catch(() => {})
|
|
|
+ );
|
|
|
+ } else {
|
|
|
+ tags.push(item as any);
|
|
|
}
|
|
|
- tags.push(item as any);
|
|
|
} else {
|
|
|
console.error("找不到ai家具", icon, name, pos);
|
|
|
}
|