@eclipse-glsp/client
Version:
A sprotty-based client for GLSP
45 lines • 1.86 kB
TypeScript
/********************************************************************************
* Copyright (c) 2024 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
********************************************************************************/
import { CenterGridSnapper, GModelElement, ISnapper, Point } from '@eclipse-glsp/sprotty';
import { Grid } from './grid';
/**
* A {@link ISnapper} implementation that snaps all elements onto a fixed gride size.
* The default grid size is 10x10 pixel.
* To configure a custom grid size bind the `TYPES.ISnapper` service identifier
* to constant value, e.g:
*
* ```ts
* bind(TYPES.ISnapper).toConstantValue(new GridSnapper({ x: 25, y: 25 }));
* ```
*
* or use the `Grid` to define the grid size more generically:
* ```ts
* bind(TYPES.Grid).toConstantValue({ x: 25, y: 25 });
* bind(TYPES.ISnapper).to(GridSnapper);
* ```
*/
export declare class GridSnapper implements ISnapper {
readonly grid: Grid;
constructor(grid?: Grid);
snap(position: Point, element: GModelElement): Point;
}
export declare class GLSPCenterGridSnapper extends CenterGridSnapper {
readonly grid: Grid;
constructor(grid?: Grid);
get gridX(): number;
get gridY(): number;
}
//# sourceMappingURL=grid-snapper.d.ts.map