Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 80119ce8

Přidáno uživatelem Pavel Fidranský před téměř 6 roky(ů)

fix saving diagram as PNG file to use CSS styles

Zobrazit rozdíly:

sources/src/main/webapp/js/components/group.js
33 33
			throw new TypeError(vertex.toString() + ' is not an instance of Vertex');
34 34
		}
35 35

  
36
		if (this._vertexList.length === 0) {
36
		if (this.position === null && this._vertexList.length === 0) {
37 37
			this.position = vertex.position;
38 38
		}
39 39

  
sources/src/main/webapp/js/components/navbar.js
327 327
			DOM.h('button', {
328 328
				class: 'btn save-diagram',
329 329
				title: 'Save diagram as PNG',
330
				onClick: () => saveSvgAsPng(document.getElementById('svg1'), 'diagram.png', { scale: 1 }),
330
				onClick: () => {
331
					let fileName = `imiger-${app.diagram === null ? 'diagram' : app.diagram.name}.png`;
332

  
333
					saveSvgAsPng(document.getElementById('svg1'), fileName, {
334
						backgroundColor: '#fff',
335
						selectorRemap: function(s) {
336
							return s.replace('.viewport ', '');
337
						},
338
					});
339
				},
331 340
			}, [
332 341
				DOM.h('img', {
333 342
					src: 'images/png_save.png',
sources/src/main/webapp/js/components/viewport.js
184 184
				}),
185 185
			]),
186 186
		]);
187
		mainSvg.appendChild(this._definitions);
187
		graph.appendChild(this._definitions);
188 188

  
189 189
		// root
190 190
		this._rootElement = DOM.h('div', {

Také k dispozici: Unified diff