@kieler/klighd-core
Version:
Core KLighD diagram visualization with Sprotty
46 lines • 2.31 kB
JavaScript
;
/*
* KIELER - Kiel Integrated Environment for Layout Eclipse RichClient
*
* http://rtsys.informatik.uni-kiel.de/kieler
*
* Copyright 2022 by
* + Kiel University
* + Department of Computer Science
* + Real-Time and Embedded Systems Group
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* SPDX-License-Identifier: EPL-2.0
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.getClusterRendering = void 0;
const sprotty_1 = require("sprotty"); // eslint-disable-line @typescript-eslint/no-unused-vars
/** Returns the rendering of clusters. */
function getClusterRendering(id, numProxies, size, x, y, opacity = 1) {
const squareSize = size * 0.9;
const squareOffset = size * 0.1;
const textSize = size * 0.5;
const color = 'rgb(220,220,220)';
const innerID = `$ProxyView$${id}`;
const outerID = `keith-diagram_sprotty_${innerID}`;
return ((0, sprotty_1.svg)("g", { id: `${outerID}1`, transform: `translate(${x}, ${y})`, style: { opacity: opacity.toString() } },
(0, sprotty_1.svg)("g", { id: `${innerID}1` },
(0, sprotty_1.svg)("rect", { width: `${squareSize}`, height: `${squareSize}`, x: `${squareOffset}`, y: `${squareOffset}`, stroke: "black", fill: color, style: { opacity: '1' } }),
(0, sprotty_1.svg)("g", { id: `${innerID}2` })),
(0, sprotty_1.svg)("g", { id: `${innerID}3` },
(0, sprotty_1.svg)("rect", { width: `${squareSize}`, height: `${squareSize}`, stroke: "black", fill: color, style: { opacity: '1' } }),
(0, sprotty_1.svg)("g", { id: `${innerID}4` })),
(0, sprotty_1.svg)("g", { id: `${outerID}2`, transform: `translate(${textSize * 0.5}, ${textSize})` },
(0, sprotty_1.svg)("g", { id: `${innerID}5` },
(0, sprotty_1.svg)("text", { style: {
dominantBaseline: 'middle',
fontFamily: 'overpass, sans-serif',
fontSize: `${textSize}`,
opacity: '1',
} }, numProxies)))));
}
exports.getClusterRendering = getClusterRendering;
//# sourceMappingURL=proxy-view-cluster.js.map