sprotty
Version:
A next-gen framework for graphical views
57 lines • 2.69 kB
TypeScript
/********************************************************************************
* 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 { VNode } from "snabbdom";
import { Action } from "sprotty-protocol/lib/actions";
import { Bounds } from "sprotty-protocol/lib/utils/geometry";
import { IActionDispatcher } from '../actions/action-dispatcher';
import { IVNodePostprocessor } from "../views/vnode-postprocessor";
import { SModelElementImpl, SModelRootImpl } from "../model/smodel";
import { SystemCommand, CommandExecutionContext, CommandReturn } from '../commands/command';
/**
* Grabs the bounds from the root element in page coordinates and fires a
* InitializeCanvasBoundsAction. This size is needed for other actions such
* as FitToScreenAction.
*/
export declare class CanvasBoundsInitializer implements IVNodePostprocessor {
protected rootAndVnode: [SModelRootImpl, VNode] | undefined;
protected actionDispatcher: IActionDispatcher;
decorate(vnode: VNode, element: SModelElementImpl): VNode;
postUpdate(): void;
protected getBoundsInPage(element: Element): {
x: number;
y: number;
width: number;
height: number;
};
}
export interface InitializeCanvasBoundsAction extends Action {
kind: typeof InitializeCanvasBoundsAction.KIND;
newCanvasBounds: Bounds;
}
export declare namespace InitializeCanvasBoundsAction {
const KIND = "initializeCanvasBounds";
function create(newCanvasBounds: Bounds): InitializeCanvasBoundsAction;
}
export declare class InitializeCanvasBoundsCommand extends SystemCommand {
protected readonly action: InitializeCanvasBoundsAction;
static readonly KIND: string;
private newCanvasBounds;
constructor(action: InitializeCanvasBoundsAction);
execute(context: CommandExecutionContext): CommandReturn;
undo(context: CommandExecutionContext): CommandReturn;
redo(context: CommandExecutionContext): CommandReturn;
}
//# sourceMappingURL=initialize-canvas.d.ts.map