UNPKG

sprotty

Version:

A next-gen framework for graphical views

94 lines 4.64 kB
/******************************************************************************** * Copyright (c) 2017-2018 TypeFox 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 ********************************************************************************/ import { Locateable } from 'sprotty-protocol/lib/model'; import { Bounds, Dimension, Point } from 'sprotty-protocol/lib/utils/geometry'; import { SChildElementImpl, SModelElementImpl, SParentElementImpl } from '../../base/model/smodel'; import { DOMHelper } from '../../base/views/dom-helper'; import { ViewerOptions } from '../../base/views/viewer-options'; export declare const boundsFeature: unique symbol; export declare const layoutContainerFeature: unique symbol; export declare const layoutableChildFeature: unique symbol; export declare const alignFeature: unique symbol; /** * Model elements that implement this interface have a position and a size. * Note that this definition differs from the one in `sprotty-protocol` because this is * used in the _internal model_, while the other is used in the _external model_. * * Feature extension interface for {@link boundsFeature}. */ export interface InternalBoundsAware { bounds: Bounds; } /** @deprecated Use `InternalBoundsAware` instead. */ export type BoundsAware = InternalBoundsAware; /** * Used to identify model elements that specify a layout to apply to their children. */ export interface InternalLayoutContainer extends InternalLayoutableChild { layout: string; } /** @deprecated Use `InternalLayoutContainer` instead. */ export type LayoutContainer = InternalLayoutContainer; export type ModelLayoutOptions = { [key: string]: string | number | boolean; }; /** * Feature extension interface for {@link layoutableChildFeature}. */ export interface InternalLayoutableChild extends InternalBoundsAware { layoutOptions?: ModelLayoutOptions; } /** @deprecated Use `InternalLayoutableChild` instead. */ export type LayoutableChild = InternalLayoutableChild; /** * Feature extension interface for {@link alignFeature}. * Used to adjust elements whose bounding box is not at the origin, e.g. * labels, or pre-rendered SVG figures. * @deprecated use the definition from `sprotty-protocol` instead. */ export interface Alignable { alignment: Point; } export declare function isBoundsAware(element: SModelElementImpl): element is SModelElementImpl & InternalBoundsAware; export declare function isLayoutContainer(element: SModelElementImpl): element is SParentElementImpl & InternalLayoutContainer; export declare function isLayoutableChild(element: SModelElementImpl): element is SChildElementImpl & InternalLayoutableChild; export declare function isSizeable(element: SModelElementImpl): element is SModelElementImpl & InternalBoundsAware; export declare function isAlignable(element: SModelElementImpl): element is SModelElementImpl & Alignable; export declare function getAbsoluteBounds(element: SModelElementImpl): Bounds; /** * Returns the "client-absolute" bounds of the specified `element`. * * The client-absolute bounds are relative to the entire browser page. * * @param element The element to get the bounds for. * @param domHelper The dom helper to obtain the SVG element's id. * @param viewerOptions The viewer options to obtain sprotty's container div id. */ export declare function getAbsoluteClientBounds(element: SModelElementImpl, domHelper: DOMHelper, viewerOptions: ViewerOptions): Bounds; export declare function findChildrenAtPosition(parent: SParentElementImpl, point: Point): SModelElementImpl[]; /** * Abstract class for elements with a position and a size. */ export declare abstract class SShapeElementImpl extends SChildElementImpl implements InternalBoundsAware, Locateable, InternalLayoutableChild { position: Point; size: Dimension; layoutOptions?: ModelLayoutOptions; get bounds(): Bounds; set bounds(newBounds: Bounds); localToParent(point: Point | Bounds): Bounds; parentToLocal(point: Point | Bounds): Bounds; } //# sourceMappingURL=model.d.ts.map