sprotty
Version:
A next-gen framework for graphical views
82 lines • 4.57 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 { Action, SetPopupModelAction, HoverFeedbackAction } from 'sprotty-protocol/lib/actions';
import { Bounds, Point } from 'sprotty-protocol/lib/utils/geometry';
import { SModelElementImpl, SModelRootImpl } from '../../base/model/smodel';
import { MouseListener } from '../../base/views/mouse-tool';
import { CommandExecutionContext, PopupCommand, SystemCommand, CommandReturn, ICommand } from '../../base/commands/command';
import { IActionHandler } from '../../base/actions/action-handler';
import { KeyListener } from '../../base/views/key-tool';
import { ViewerOptions } from '../../base/views/viewer-options';
export declare class HoverFeedbackCommand extends SystemCommand {
protected readonly action: HoverFeedbackAction;
static readonly KIND = "hoverFeedback";
constructor(action: HoverFeedbackAction);
execute(context: CommandExecutionContext): CommandReturn;
undo(context: CommandExecutionContext): CommandReturn;
redo(context: CommandExecutionContext): CommandReturn;
}
export declare class SetPopupModelCommand extends PopupCommand {
protected readonly action: SetPopupModelAction;
static readonly KIND = "setPopupModel";
oldRoot: SModelRootImpl;
newRoot: SModelRootImpl;
constructor(action: SetPopupModelAction);
execute(context: CommandExecutionContext): CommandReturn;
undo(context: CommandExecutionContext): CommandReturn;
redo(context: CommandExecutionContext): CommandReturn;
}
export interface HoverState {
mouseOverTimer: number | undefined;
mouseOutTimer: number | undefined;
popupOpen: boolean;
previousPopupElement: SModelElementImpl | undefined;
}
export declare abstract class AbstractHoverMouseListener extends MouseListener {
protected mouseIsDown: boolean;
protected options: ViewerOptions;
protected state: HoverState;
mouseDown(target: SModelElementImpl, event: MouseEvent): (Action | Promise<Action>)[];
mouseUp(target: SModelElementImpl, event: MouseEvent): (Action | Promise<Action>)[];
protected stopMouseOutTimer(): void;
protected startMouseOutTimer(): Promise<Action>;
protected stopMouseOverTimer(): void;
}
export declare class HoverMouseListener extends AbstractHoverMouseListener {
protected lastHoverFeedbackElementId?: string;
protected options: ViewerOptions;
protected computePopupBounds(target: SModelElementImpl, mousePosition: Point): Bounds;
protected allowSidePosition(target: SModelElementImpl, side: 'above' | 'below' | 'left' | 'right', distance: number): boolean;
protected startMouseOverTimer(target: SModelElementImpl, event: MouseEvent): Promise<Action>;
mouseOver(target: SModelElementImpl, event: MouseEvent): (Action | Promise<Action>)[];
mouseOut(target: SModelElementImpl, event: MouseEvent): (Action | Promise<Action>)[];
protected getElementFromEventPosition(event: MouseEvent): Element | null;
protected isSprottyPopup(element: Element | null): boolean;
mouseMove(target: SModelElementImpl, event: MouseEvent): (Action | Promise<Action>)[];
protected closeOnMouseMove(target: SModelElementImpl, event: MouseEvent): boolean;
}
export declare class PopupHoverMouseListener extends AbstractHoverMouseListener {
mouseOut(target: SModelElementImpl, event: MouseEvent): (Action | Promise<Action>)[];
mouseOver(target: SModelElementImpl, event: MouseEvent): (Action | Promise<Action>)[];
}
export declare class HoverKeyListener extends KeyListener {
keyDown(element: SModelElementImpl, event: KeyboardEvent): Action[];
}
export declare class ClosePopupActionHandler implements IActionHandler {
protected popupOpen: boolean;
handle(action: Action): void | ICommand | Action;
}
//# sourceMappingURL=hover.d.ts.map