UNPKG

sprotty

Version:

A next-gen framework for graphical views

75 lines 4.6 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 { VNode } from "snabbdom"; import { Action } from "sprotty-protocol/lib/actions"; import { Point } from "sprotty-protocol/lib/utils/geometry"; import { IActionDispatcher } from "../actions/action-dispatcher"; import { SModelElementImpl, SModelRootImpl } from "../model/smodel"; import { DOMHelper } from "./dom-helper"; import { IVNodePostprocessor } from "./vnode-postprocessor"; export declare class MouseTool implements IVNodePostprocessor { protected mouseListeners: MouseListener[]; protected actionDispatcher: IActionDispatcher; protected domHelper: DOMHelper; constructor(mouseListeners?: MouseListener[]); register(mouseListener: MouseListener): void; deregister(mouseListener: MouseListener): void; protected getTargetElement(model: SModelRootImpl, event: MouseEvent): SModelElementImpl | undefined; protected handleEvent(methodName: MouseEventKind, model: SModelRootImpl, event: MouseEvent): void; protected focusOnMouseEvent<K extends keyof MouseListener>(methodName: K, model: SModelRootImpl): void; mouseOver(model: SModelRootImpl, event: MouseEvent): void; mouseOut(model: SModelRootImpl, event: MouseEvent): void; mouseEnter(model: SModelRootImpl, event: MouseEvent): void; mouseLeave(model: SModelRootImpl, event: MouseEvent): void; mouseDown(model: SModelRootImpl, event: MouseEvent): void; mouseMove(model: SModelRootImpl, event: MouseEvent): void; mouseUp(model: SModelRootImpl, event: MouseEvent): void; wheel(model: SModelRootImpl, event: WheelEvent): void; contextMenu(model: SModelRootImpl, event: MouseEvent): void; doubleClick(model: SModelRootImpl, event: MouseEvent): void; decorate(vnode: VNode, element: SModelElementImpl): VNode; postUpdate(): void; } export declare class PopupMouseTool extends MouseTool { protected mouseListeners: MouseListener[]; constructor(mouseListeners?: MouseListener[]); } export type MouseEventKind = 'mouseOver' | 'mouseOut' | 'mouseEnter' | 'mouseLeave' | 'mouseDown' | 'mouseMove' | 'mouseUp' | 'wheel' | 'doubleClick' | 'contextMenu' | 'dragOver' | 'drop'; export declare class MouseListener { mouseOver(target: SModelElementImpl, event: MouseEvent): (Action | Promise<Action>)[]; mouseOut(target: SModelElementImpl, event: MouseEvent): (Action | Promise<Action>)[]; mouseEnter(target: SModelElementImpl, event: MouseEvent): (Action | Promise<Action>)[]; mouseLeave(target: SModelElementImpl, event: MouseEvent): (Action | Promise<Action>)[]; mouseDown(target: SModelElementImpl, event: MouseEvent): (Action | Promise<Action>)[]; mouseMove(target: SModelElementImpl, event: MouseEvent): (Action | Promise<Action>)[]; mouseUp(target: SModelElementImpl, event: MouseEvent): (Action | Promise<Action>)[]; wheel(target: SModelElementImpl, event: WheelEvent): (Action | Promise<Action>)[]; doubleClick(target: SModelElementImpl, event: MouseEvent): (Action | Promise<Action>)[]; contextMenu(target: SModelElementImpl, event: MouseEvent): (Action | Promise<Action>)[]; dragOver(target: SModelElementImpl, event: MouseEvent): (Action | Promise<Action>)[]; drop(target: SModelElementImpl, event: MouseEvent): (Action | Promise<Action>)[]; decorate(vnode: VNode, element: SModelElementImpl): VNode; } export declare class MousePositionTracker extends MouseListener { protected lastPosition: Point | undefined; mouseMove(target: SModelElementImpl, event: MouseEvent): (Action | Promise<Action>)[]; /** * Returns the last tracked mouse cursor position relative to the diagram root or `undefined` * if no mouse cursor position was ever tracked yet. */ get lastPositionOnDiagram(): Point | undefined; } //# sourceMappingURL=mouse-tool.d.ts.map