UNPKG

@eclipse-glsp/graph

Version:

The typescript implementation of the GLSP graphical model (GModel)

44 lines 1.84 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.GBoundsAwareBuilder = exports.isGBoundsAware = exports.GBoundsAware = void 0; exports.GBoundsAware = Symbol('GBoundsAware'); function isGBoundsAware(element) { return exports.GBoundsAware in element && element[exports.GBoundsAware] === true; } exports.isGBoundsAware = isGBoundsAware; var GBoundsAwareBuilder; (function (GBoundsAwareBuilder) { function position(builder, pointOrX, y) { const proxy = builder['proxy']; if (typeof pointOrX === 'object') { proxy.position = pointOrX; } else if (y !== undefined) { proxy.position = { x: pointOrX, y }; } else { // Optionally handle cases where y is not provided proxy.position = { x: pointOrX, y: 0 }; console.warn(`Incomplete parameters for GBoundsAwareBuilder.position function. Setting position to ${JSON.stringify(proxy.position)}`); } return builder; } GBoundsAwareBuilder.position = position; function size(builder, sizeOrWidth, height) { const proxy = builder['proxy']; if (typeof sizeOrWidth === 'object') { proxy.size = sizeOrWidth; } else if (height !== undefined) { proxy.size = { width: sizeOrWidth, height }; } else { // Optionally handle cases where height is not provided proxy.size = { width: sizeOrWidth, height: 0 }; console.warn(`Incomplete parameters for GBoundsAwareBuilder.size function. Setting size to ${JSON.stringify(proxy.size)}`); } return builder; } GBoundsAwareBuilder.size = size; })(GBoundsAwareBuilder || (exports.GBoundsAwareBuilder = GBoundsAwareBuilder = {})); //# sourceMappingURL=gbounds-aware.js.map