Sidebar-Heater.js
2.38 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
(function () {
	// Adds Atlassian shapes
	// heater label
	Sidebar.prototype.addHeaterPalette = function () {
		const { COMPONENT_TYPE } = this.enumCellBasicAttribute
		const { DEFAULT } = this.enumComponentType
		const gn = 'mxgraph.heater';
		const dt = 'heater';
		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: 'heater/加热器.svg' },
			{ name: '批烤箱.svg', path: 'heater/批烤箱.svg' },
			{ name: '换热器.svg', path: 'heater/换热器.svg' },
			{ name: '换热器2.svg', path: 'heater/换热器2.svg' },
			{ name: '换热器3.svg', path: 'heater/换热器3.svg' },
			{ name: '换热器4.svg', path: 'heater/换热器4.svg' },
			{ name: '火焰锅炉.svg', path: 'heater/火焰锅炉.svg' },
			{ name: '热回收锅炉.svg', path: 'heater/热回收锅炉.svg' },
			{ name: '燃油锅炉.svg', path: 'heater/燃油锅炉.svg' },
			{ name: '燃煤锅炉.svg', path: 'heater/燃煤锅炉.svg' },
			{ name: '蒸发器.svg', path: 'heater/蒸发器.svg' },
			{ name: '蒸汽混合器.svg', path: 'heater/蒸汽混合器.svg' },
			{ name: '蒸汽混合器2.svg', path: 'heater/蒸汽混合器2.svg' },
			{ name: '蒸汽锅炉.svg', path: 'heater/蒸汽锅炉.svg' },
			{ name: '过热器.svg', path: 'heater/过热器.svg' },
			{ name: '锅炉.svg', path: 'heater/锅炉.svg' },
			{ name: '锅炉2.svg', path: 'heater/锅炉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();
	};
})();