UNPKG

@kieler/klighd-core

Version:

Core KLighD diagram visualization with Sprotty

40 lines 1.41 kB
"use strict"; /* * KIELER - Kiel Integrated Environment for Layout Eclipse RichClient * * http://rtsys.informatik.uni-kiel.de/kieler * * Copyright 2024 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.KielerLayoutConfigurator = void 0; const sprotty_elk_1 = require("sprotty-elk"); /** * This layout configurator copies all layout options from the KGraph element's properties. */ class KielerLayoutConfigurator extends sprotty_elk_1.DefaultLayoutConfigurator { apply(element, _index) { // Only apply to elements with properties. if (element.properties === undefined) { return undefined; } const properties = element.properties; // map properties to layout options and stringify values const layoutOptions = {}; Object.entries(properties).forEach(([key, value]) => { layoutOptions[key] = JSON.stringify(value); }); return layoutOptions; } } exports.KielerLayoutConfigurator = KielerLayoutConfigurator; //# sourceMappingURL=layout-config.js.map