/******************************************************************************** * Copyright (c) 2025-2026 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 { Disposable, DisposableCollection, Emitter, Event, GModelRoot, ICommand, ICommandStack, LazyInjector, Viewport } from '@eclipse-glsp/sprotty'; /** * Service that tracks changes to the model root and the viewport. * Allows to register listeners that are notified when the model root or the viewport changes. * The current model root can be queried at any time. */ export interface IModelChangeService { /** The current model root */ readonly currentRoot: Readonly | undefined; /** * Event that is fired when the model root of the diagram changes i.e. after the `CommandStack` has processed a model update. */ onModelRootChanged: Event>; /** * Event that is fired when the viewport of the diagram changes i.e. after the `CommandStack` has processed a viewport update. * By default, this event is only fired if the viewport was changed via a `SetViewportCommand` or `BoundsAwareViewportCommand` */ onViewportChanged: Event; } /** * Event data for the {@link IModelChangeService.onViewportChanged} event. */ export interface ViewportChange { /** The new viewport */ newViewport: Readonly; /** The old viewport */ oldViewport?: Readonly; } export declare class ModelChangeService implements IModelChangeService, Disposable { protected lazyInjector: LazyInjector; protected _currentRoot?: Readonly; protected lastViewport?: Readonly; protected toDispose: DisposableCollection; get currentRoot(): Readonly | undefined; protected get commandStack(): ICommandStack; protected onModelRootChangedEmitter: Emitter>; get onModelRootChanged(): Event>; protected onViewportChangedEmitter: Emitter; get onViewportChanged(): Event; protected initialize(): void; dispose(): void; protected handleCommandExecution(command: ICommand, newRoot: GModelRoot): void; protected isModelRootChangeCommand(command: ICommand): boolean; protected isViewportChangeCommand(command: ICommand): boolean; protected handleModelRootChangeCommand(command: ICommand, newRoot: GModelRoot): void; protected handleViewportChangeCommand(command: ICommand, newRoot: GModelRoot): void; protected hasViewportChanged(newViewport: Readonly): boolean; protected toViewport(root: Readonly): Readonly | undefined; } //# sourceMappingURL=model-change-service.d.ts.map