@eclipse-glsp/client
Version:
A sprotty-based client for GLSP
61 lines • 2.4 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.GEdge = exports.GGraph = void 0;
/********************************************************************************
* Copyright (c) 2023 EclipseSource and others.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* This Source Code may also be made available under the following Secondary
* Licenses when the conditions for such availability set forth in the Eclipse
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
* with the GNU Classpath Exception which is available at
* https://www.gnu.org/software/classpath/license.html.
*
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
********************************************************************************/
const sprotty_1 = require("@eclipse-glsp/sprotty");
const args_feature_1 = require("./base/args-feature");
const model_1 = require("./features/hints/model");
class GGraph extends sprotty_1.SGraphImpl {
isContainableElement(_input) {
return true;
}
}
exports.GGraph = GGraph;
GGraph.DEFAULT_FEATURES = [...sprotty_1.SGraphImpl.DEFAULT_FEATURES, model_1.containerFeature, args_feature_1.argsFeature];
class GEdge extends sprotty_1.SEdgeImpl {
localToParent(point) {
const bounds = (0, sprotty_1.getRouteBounds)(this.routingPoints);
const result = {
x: point.x + bounds.x,
y: point.y + bounds.y,
width: -1,
height: -1
};
if ((0, sprotty_1.isBounds)(point)) {
result.width = point.width;
result.height = point.height;
}
return result;
}
parentToLocal(point) {
const bounds = (0, sprotty_1.getRouteBounds)(this.routingPoints);
const result = {
x: point.x - bounds.x,
y: point.y - bounds.y,
width: -1,
height: -1
};
if ((0, sprotty_1.isBounds)(point)) {
result.width = point.width;
result.height = point.height;
}
return result;
}
}
exports.GEdge = GEdge;
GEdge.DEFAULT_FEATURES = [...sprotty_1.SEdgeImpl.DEFAULT_FEATURES, args_feature_1.argsFeature];
//# sourceMappingURL=model.js.map