Sidebar-Valve.js
2.76 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
65
66
67
68
69
(function () {
// Adds Atlassian shapes
// valve 阀门
Sidebar.prototype.addValvePalette = function () {
const { COMPONENT_TYPE } = this.enumCellBasicAttribute
const { DEFAULT } = this.enumComponentType
const gn = 'mxgraph.valve';
const dt = 'valve';
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: '卸灰阀.svg', path: 'valve/卸灰阀.svg' },
{ name: '双通阀.svg', path: 'valve/双通阀.svg' },
{ name: '垂直单向阀.svg', path: 'valve/垂直单向阀.svg' },
{ name: '垂直控制阀.svg', path: 'valve/垂直控制阀.svg' },
{ name: '塑料旋启式止回阀.svg', path: 'valve/塑料旋启式止回阀.svg' },
{ name: '夹管阀.svg', path: 'valve/夹管阀.svg' },
{ name: '安全阀.svg', path: 'valve/安全阀.svg' },
{ name: '手动阀 1.svg', path: 'valve/手动阀 1.svg' },
{ name: '手动阀 2.svg', path: 'valve/手动阀 2.svg' },
{ name: '控制阀 2.svg', path: 'valve/控制阀 2.svg' },
{ name: '控制阀.svg', path: 'valve/控制阀.svg' },
{ name: '旋转阀.svg', path: 'valve/旋转阀.svg' },
{ name: '水平单向阀.svg', path: 'valve/水平单向阀.svg' },
{ name: '水平控制阀.svg', path: 'valve/水平控制阀.svg' },
{ name: '水平控制阀2.svg', path: 'valve/水平控制阀2.svg' },
{ name: '水平控制阀3.svg', path: 'valve/水平控制阀3.svg' },
{ name: '法兰控制阀.svg', path: 'valve/法兰控制阀.svg' },
{ name: '球形阀 1.svg', path: 'valve/球形阀 1.svg' },
{ name: '球形阀 2.svg', path: 'valve/球形阀 2.svg' },
{ name: '球形阀 3.svg', path: 'valve/球形阀 3.svg' },
{ name: '电动阀.svg', path: 'valve/电动阀.svg' },
{ name: '阀门.svg', path: 'valve/阀门.svg' },
{ name: '阀门2.svg', path: 'valve/阀门2.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();
};
})();