Sidebar-Engine.js
2.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
(function () {
// Adds Atlassian shapes
// engine 发动机
Sidebar.prototype.addEnginePalette = function () {
const { COMPONENT_TYPE } = this.enumCellBasicAttribute
const { DEFAULT } = this.enumComponentType
const gn = 'mxgraph.engine';
const dt = 'engine';
const label = '发动机'
const width = 66;
const height = 74;
const staticPath = `${Proxy_Prefix}/img/lib/thingskit/`
const prefix = 'image;image=img/lib/thingskit/'
const defaultStyle = ';imageAspect=0;'
this.setCurrentSearchEntryLibrary(dt);
// 自定义属性
const cellAttribute = {
[COMPONENT_TYPE]: DEFAULT
}
const graphPathLib = [
{ name: '3-D 发动机.svg', path: 'engine/3-D 发动机.svg' },
{ name: '伺服电机.svg', path: 'engine/伺服电机.svg' },
{ name: '伺服电机2.svg', path: 'engine/伺服电机2.svg' },
{ name: '促动器.svg', path: 'engine/促动器.svg' },
{ name: '减速器.svg', path: 'engine/减速器.svg' },
{ name: '制动马达.svg', path: 'engine/制动马达.svg' },
{ name: '发动机 1.svg', path: 'engine/发动机 1.svg' },
{ name: '发动机 2.svg', path: 'engine/发动机 2.svg' },
{ name: '发动机 3.svg', path: 'engine/发动机 3.svg' },
{ name: '发动机 4.svg', path: 'engine/发动机 4.svg' },
{ name: '工业标准发动机.svg', path: 'engine/工业标准发动机.svg' },
{ name: '无刷电机.svg', path: 'engine/无刷电机.svg' },
{ name: '智能马达.svg', path: 'engine/智能马达.svg' },
{ name: '步进电机驱动器.svg', path: 'engine/步进电机驱动器.svg' },
{ name: '气压制动器.svg', path: 'engine/气压制动器.svg' },
{ name: '简单马达.svg', path: 'engine/简单马达.svg' },
{ name: '轴角编码器.svg', path: 'engine/轴角编码器.svg' },
{ name: '防爆电动机.svg', path: 'engine/防爆电动机.svg' },
]
const lib = graphPathLib.map(item => {
item.staticPath = staticPath + item.path
return item
})
const fns = graphPathLib.map(item => {
return this.addEntry(this.getTagsForStencil(gn, item.name, dt).join(' '), mxUtils.bind(this, function () {
const cell = new mxCell('', new mxGeometry(0, 0, width, height), `${prefix}${item.path}${defaultStyle}`);
cell.setVertex(true)
this.setCellAttributes(cell, cellAttribute)
return this.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, item.name);
}));
})
this.setVariableImageLib(dt, label, lib)
this.addPaletteFunctions(dt, label, false, fns);
this.setCurrentSearchEntryLibrary();
};
})();