32 lines
2.2 KiB
JavaScript
32 lines
2.2 KiB
JavaScript
import * as path from 'zrender/src/tool/path';
|
|
const map = {
|
|
LampFilament: {
|
|
width: 86,
|
|
path: 'M86,52c0,16.926-9.783,29.561-24,36.576V118H55v-2H33v2H26V89.5C10.708,82.912,0,69.709,0,52,0,29.6,17.128,13.211,39,11.192V0H49V11.426C69.906,14.346,86,30.289,86,52ZM33,112H55v-5H33v5Zm0-10H55V91.29A36.219,36.219,0,0,1,44,93a52.073,52.073,0,0,1-11-1.181V102ZM44.432,60c11.261-.156,12.854-1.8,12.508-7.711-0.379-6.469-2.007-8.3-12.508-8.3S30,45.227,30,51.7,33.933,60.15,44.432,60ZM44,21C22.171,21,9,30.171,9,52,9,72.119,19.892,79.722,39,81.732V68.151c-9.712-1.614-18-8.725-18-16.778C21,42.115,31.626,35,43.5,35S66,42.115,66,51.373c0,7.773-7.8,14.68-17,16.578V81.614C67.932,78.754,77.725,65.057,78,51,78.3,35.667,65.829,21,44,21Z'
|
|
},
|
|
Unmanned: {
|
|
width: 197,
|
|
path: 'M98.5,197A98.5,98.5,0,1,1,197,98.5,98.5,98.5,0,0,1,98.5,197ZM25,45.728a90.478,90.478,0,0,0,122.251,129L148,165l-29.692-30.2c0.031,17.084-.028,31.694-0.308,34.2-1.047,9.373-4.3,12.285-11,11-16.2-3.1-4.369-70.44-12-66-4.268,2.483,6.073,65.533-8,64-4.346-.473-10.546-1.463-11-7-2.633-32.142-.884-76.646-2-81-0.383-1.493-2.908-1.552-3,0-0.836,14.065-.1,22.735-5,27-6.387,5.558-13.106-1.269-14-6-3.531-18.681,2.693-41.954,0-44L32,47ZM98.5,8A90.056,90.056,0,0,0,46,24.808V34L65.788,53.293C73.019,51.42,83.279,52.349,97,52c41.133-1.046,48.794-.992,45,56-0.748,11.235-12.6,6.264-17,2-3.213-3.116.221-27.807-2-34-1.758-4.9-5.015-5.735-5-2,0.013,3.177.106,15.55,0.188,30.383L166,151l7.025-1.171A90.488,90.488,0,0,0,98.5,8Zm-2,41A16.5,16.5,0,1,1,113,32.5,16.5,16.5,0,0,1,96.5,49Z'
|
|
},
|
|
ControlSwitch: {
|
|
width: 90,
|
|
path: 'M6.429,40.85H0V15.05H51.429L64.286,0H77.143L90,15.05V31L79,43H64.286L51.429,30.1h-30V40.85H12.857V30.1H6.429V40.85ZM60,17.2l4.286-4.3H77.143l4.286,4.3V27.95l-4.286,4.3H64.286L60,27.95V17.2Z'
|
|
}
|
|
};
|
|
|
|
export default function createPathSvg(model) {
|
|
const svg = path.createFromString(map[model._subType].path, {
|
|
shape: {
|
|
zlevel: model.zlevel,
|
|
z: model.z
|
|
},
|
|
style: {
|
|
fill: model.fill
|
|
}
|
|
});
|
|
const scaleX = model.width / map[model._subType].width;
|
|
svg.scale = [scaleX, scaleX];
|
|
svg.position = [model.x, model.y];
|
|
return svg;
|
|
}
|