@eclipse-glsp/client
Version:
A sprotty-based client for GLSP
62 lines • 4.43 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.standaloneViewportModule = exports.viewportModule = void 0;
/********************************************************************************
* Copyright (c) 2021-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
********************************************************************************/
const sprotty_1 = require("@eclipse-glsp/sprotty");
const tool_1 = require("../../base/tool-manager/tool");
const actions_1 = require("../accessibility/actions");
const glsp_scroll_mouse_listener_1 = require("./glsp-scroll-mouse-listener");
const origin_viewport_1 = require("./origin-viewport");
const reposition_1 = require("./reposition");
const viewport_handler_1 = require("./viewport-handler");
const viewport_key_listener_1 = require("./viewport-key-listener");
const viewport_tool_1 = require("./viewport-tool");
const zoom_viewport_action_1 = require("./zoom-viewport-action");
exports.viewportModule = new sprotty_1.FeatureModule((bind, _unbind, isBound) => {
const context = { bind, isBound };
(0, sprotty_1.configureCommand)(context, sprotty_1.CenterCommand);
(0, sprotty_1.configureCommand)(context, sprotty_1.FitToScreenCommand);
(0, sprotty_1.configureCommand)(context, sprotty_1.GetViewportCommand);
(0, sprotty_1.configureCommand)(context, sprotty_1.SetViewportCommand);
(0, sprotty_1.configureCommand)(context, reposition_1.RepositionCommand);
(0, sprotty_1.configureCommand)(context, origin_viewport_1.OriginViewportCommand);
(0, sprotty_1.bindAsService)(context, sprotty_1.TYPES.MouseListener, sprotty_1.ZoomMouseListener);
(0, sprotty_1.bindAsService)(context, sprotty_1.TYPES.MouseListener, glsp_scroll_mouse_listener_1.GLSPScrollMouseListener);
(0, sprotty_1.configureActionHandler)(context, tool_1.EnableToolsAction.KIND, glsp_scroll_mouse_listener_1.GLSPScrollMouseListener);
(0, sprotty_1.configureActionHandler)(context, tool_1.EnableDefaultToolsAction.KIND, glsp_scroll_mouse_listener_1.GLSPScrollMouseListener);
(0, sprotty_1.bindAsService)(context, sprotty_1.TYPES.IDiagramStartup, viewport_handler_1.RestoreViewportHandler);
(0, sprotty_1.configureActionHandler)(context, tool_1.EnableDefaultToolsAction.KIND, viewport_handler_1.RestoreViewportHandler);
(0, sprotty_1.configureActionHandler)(context, actions_1.FocusDomAction.KIND, viewport_handler_1.RestoreViewportHandler);
bind(sprotty_1.TYPES.ZoomFactors).toConstantValue(zoom_viewport_action_1.ZoomFactors.DEFAULT);
(0, sprotty_1.bindAsService)(context, sprotty_1.TYPES.IDefaultTool, viewport_tool_1.ViewportKeyTool);
bind(viewport_handler_1.MoveViewportHandler).toSelf().inSingletonScope();
bind(viewport_key_listener_1.MoveViewportKeyListener).toSelf();
(0, sprotty_1.configureActionHandler)(context, sprotty_1.MoveViewportAction.KIND, viewport_handler_1.MoveViewportHandler);
bind(viewport_handler_1.ZoomHandler).toSelf().inSingletonScope();
bind(viewport_key_listener_1.ZoomKeyListener).toSelf();
(0, sprotty_1.configureActionHandler)(context, zoom_viewport_action_1.ZoomAction.KIND, viewport_handler_1.ZoomHandler);
}, { featureId: Symbol('viewport') });
/**
* Feature module that is intended for the standalone deployment of GLSP (i.e. plain webapp)
* When integrated into an application frame (e.g Theia/VS Code) this module is typically omitted and/or replaced
* with an application native module.
*/
exports.standaloneViewportModule = new sprotty_1.FeatureModule((bind, _unbind, isBound) => {
const context = { bind, isBound };
(0, sprotty_1.bindAsService)(context, sprotty_1.TYPES.KeyListener, sprotty_1.CenterKeyboardListener);
}, { featureId: Symbol('standaloneViewport'), requires: exports.viewportModule });
//# sourceMappingURL=viewport-modules.js.map