未验证 提交 81e71a4a 编写于 作者: A Alex Dima

Rename ViewOutgoingEvents to ViewUserInputEvents

上级 a8fe75f0
......@@ -6,7 +6,7 @@
import { IKeyboardEvent } from 'vs/base/browser/keyboardEvent';
import { CoreEditorCommand, CoreNavigationCommands } from 'vs/editor/browser/controller/coreCommands';
import { IEditorMouseEvent, IPartialEditorMouseEvent } from 'vs/editor/browser/editorBrowser';
import { ViewOutgoingEvents } from 'vs/editor/browser/view/viewOutgoingEvents';
import { ViewUserInputEvents } from 'vs/editor/browser/view/viewUserInputEvents';
import { Position } from 'vs/editor/common/core/position';
import { Selection } from 'vs/editor/common/core/selection';
import { IConfiguration } from 'vs/editor/common/editorCommon';
......@@ -49,18 +49,18 @@ export class ViewController {
private readonly configuration: IConfiguration;
private readonly viewModel: IViewModel;
private readonly outgoingEvents: ViewOutgoingEvents;
private readonly userInputEvents: ViewUserInputEvents;
private readonly commandDelegate: ICommandDelegate;
constructor(
configuration: IConfiguration,
viewModel: IViewModel,
outgoingEvents: ViewOutgoingEvents,
userInputEvents: ViewUserInputEvents,
commandDelegate: ICommandDelegate
) {
this.configuration = configuration;
this.viewModel = viewModel;
this.outgoingEvents = outgoingEvents;
this.userInputEvents = userInputEvents;
this.commandDelegate = commandDelegate;
}
......@@ -289,42 +289,42 @@ export class ViewController {
}
public emitKeyDown(e: IKeyboardEvent): void {
this.outgoingEvents.emitKeyDown(e);
this.userInputEvents.emitKeyDown(e);
}
public emitKeyUp(e: IKeyboardEvent): void {
this.outgoingEvents.emitKeyUp(e);
this.userInputEvents.emitKeyUp(e);
}
public emitContextMenu(e: IEditorMouseEvent): void {
this.outgoingEvents.emitContextMenu(e);
this.userInputEvents.emitContextMenu(e);
}
public emitMouseMove(e: IEditorMouseEvent): void {
this.outgoingEvents.emitMouseMove(e);
this.userInputEvents.emitMouseMove(e);
}
public emitMouseLeave(e: IPartialEditorMouseEvent): void {
this.outgoingEvents.emitMouseLeave(e);
this.userInputEvents.emitMouseLeave(e);
}
public emitMouseUp(e: IEditorMouseEvent): void {
this.outgoingEvents.emitMouseUp(e);
this.userInputEvents.emitMouseUp(e);
}
public emitMouseDown(e: IEditorMouseEvent): void {
this.outgoingEvents.emitMouseDown(e);
this.userInputEvents.emitMouseDown(e);
}
public emitMouseDrag(e: IEditorMouseEvent): void {
this.outgoingEvents.emitMouseDrag(e);
this.userInputEvents.emitMouseDrag(e);
}
public emitMouseDrop(e: IPartialEditorMouseEvent): void {
this.outgoingEvents.emitMouseDrop(e);
this.userInputEvents.emitMouseDrop(e);
}
public emitMouseWheel(e: IMouseWheelEvent): void {
this.outgoingEvents.emitMouseWheel(e);
this.userInputEvents.emitMouseWheel(e);
}
}
......@@ -14,7 +14,7 @@ import { PointerHandler } from 'vs/editor/browser/controller/pointerHandler';
import { ITextAreaHandlerHelper, TextAreaHandler } from 'vs/editor/browser/controller/textAreaHandler';
import { IContentWidget, IContentWidgetPosition, IOverlayWidget, IOverlayWidgetPosition, IMouseTarget, IViewZoneChangeAccessor, IEditorAriaOptions } from 'vs/editor/browser/editorBrowser';
import { ICommandDelegate, ViewController } from 'vs/editor/browser/view/viewController';
import { ViewOutgoingEvents } from 'vs/editor/browser/view/viewOutgoingEvents';
import { ViewUserInputEvents } from 'vs/editor/browser/view/viewUserInputEvents';
import { ContentViewOverlays, MarginViewOverlays } from 'vs/editor/browser/view/viewOverlays';
import { PartFingerprint, PartFingerprints, ViewPart } from 'vs/editor/browser/view/viewPart';
import { ViewContentWidgets } from 'vs/editor/browser/viewParts/contentWidgets/contentWidgets';
......@@ -80,8 +80,6 @@ export class View extends ViewEventHandler {
private readonly _textAreaHandler: TextAreaHandler;
private readonly pointerHandler: PointerHandler;
private readonly outgoingEvents: ViewOutgoingEvents;
// Dom nodes
private linesContent: FastDomNode<HTMLElement>;
public domNode: FastDomNode<HTMLElement>;
......@@ -95,14 +93,13 @@ export class View extends ViewEventHandler {
configuration: IConfiguration,
themeService: IThemeService,
model: IViewModel,
outgoingEvents: ViewOutgoingEvents
userInputEvents: ViewUserInputEvents
) {
super();
this._selections = [new Selection(1, 1, 1, 1)];
this._renderAnimationFrame = null;
this.outgoingEvents = outgoingEvents;
const viewController = new ViewController(configuration, model, this.outgoingEvents, commandDelegate);
const viewController = new ViewController(configuration, model, userInputEvents, commandDelegate);
// The view context is passed on to most classes (basically to reduce param. counts in ctors)
this._context = new ViewContext(configuration, themeService.getColorTheme(), model);
......@@ -321,7 +318,6 @@ export class View extends ViewEventHandler {
}
this._context.removeEventHandler(this);
this.outgoingEvents.dispose();
this.viewLines.dispose();
......@@ -443,7 +439,7 @@ export class View extends ViewEventHandler {
if (!mouseTarget) {
return null;
}
return ViewOutgoingEvents.convertViewToModelMouseTarget(mouseTarget, this._context.model.coordinatesConverter);
return ViewUserInputEvents.convertViewToModelMouseTarget(mouseTarget, this._context.model.coordinatesConverter);
}
public createOverviewRuler(cssClassName: string): OverviewRuler {
......
......@@ -4,19 +4,18 @@
*--------------------------------------------------------------------------------------------*/
import { IKeyboardEvent } from 'vs/base/browser/keyboardEvent';
import { Disposable } from 'vs/base/common/lifecycle';
import { MouseTarget } from 'vs/editor/browser/controller/mouseTarget';
import { IEditorMouseEvent, IMouseTarget, IPartialEditorMouseEvent, MouseTargetType } from 'vs/editor/browser/editorBrowser';
import { Position } from 'vs/editor/common/core/position';
import { Range } from 'vs/editor/common/core/range';
import { IViewModel, ICoordinatesConverter } from 'vs/editor/common/viewModel/viewModel';
import { ICoordinatesConverter } from 'vs/editor/common/viewModel/viewModel';
import { IMouseWheelEvent } from 'vs/base/browser/mouseEvent';
export interface EventCallback<T> {
(event: T): void;
}
export class ViewOutgoingEvents extends Disposable {
export class ViewUserInputEvents {
public onKeyDown: EventCallback<IKeyboardEvent> | null = null;
public onKeyUp: EventCallback<IKeyboardEvent> | null = null;
......@@ -29,11 +28,10 @@ export class ViewOutgoingEvents extends Disposable {
public onMouseDrop: EventCallback<IPartialEditorMouseEvent> | null = null;
public onMouseWheel: EventCallback<IMouseWheelEvent> | null = null;
private readonly _viewModel: IViewModel;
private readonly _coordinatesConverter: ICoordinatesConverter;
constructor(viewModel: IViewModel) {
super();
this._viewModel = viewModel;
constructor(coordinatesConverter: ICoordinatesConverter) {
this._coordinatesConverter = coordinatesConverter;
}
public emitKeyDown(e: IKeyboardEvent): void {
......@@ -109,7 +107,7 @@ export class ViewOutgoingEvents extends Disposable {
}
private _convertViewToModelMouseTarget(target: IMouseTarget): IMouseTarget {
return ViewOutgoingEvents.convertViewToModelMouseTarget(target, this._viewModel.coordinatesConverter);
return ViewUserInputEvents.convertViewToModelMouseTarget(target, this._coordinatesConverter);
}
public static convertViewToModelMouseTarget(target: IMouseTarget, coordinatesConverter: ICoordinatesConverter): IMouseTarget {
......
......@@ -21,7 +21,7 @@ import { EditorExtensionsRegistry, IEditorContributionDescription } from 'vs/edi
import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService';
import { ICommandDelegate } from 'vs/editor/browser/view/viewController';
import { IContentWidgetData, IOverlayWidgetData, View } from 'vs/editor/browser/view/viewImpl';
import { ViewOutgoingEvents } from 'vs/editor/browser/view/viewOutgoingEvents';
import { ViewUserInputEvents } from 'vs/editor/browser/view/viewUserInputEvents';
import { ConfigurationChangedEvent, EditorLayoutInfo, IEditorOptions, EditorOption, IComputedEditorOptions, FindComputedEditorOptionValueById, IEditorConstructionOptions, filterValidationDecorations } from 'vs/editor/common/config/editorOptions';
import { Cursor } from 'vs/editor/common/controller/cursor';
import { CursorColumns } from 'vs/editor/common/controller/cursorCommon';
......@@ -1604,24 +1604,24 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
};
}
const viewOutgoingEvents = new ViewOutgoingEvents(viewModel);
viewOutgoingEvents.onKeyDown = (e) => this._onKeyDown.fire(e);
viewOutgoingEvents.onKeyUp = (e) => this._onKeyUp.fire(e);
viewOutgoingEvents.onContextMenu = (e) => this._onContextMenu.fire(e);
viewOutgoingEvents.onMouseMove = (e) => this._onMouseMove.fire(e);
viewOutgoingEvents.onMouseLeave = (e) => this._onMouseLeave.fire(e);
viewOutgoingEvents.onMouseDown = (e) => this._onMouseDown.fire(e);
viewOutgoingEvents.onMouseUp = (e) => this._onMouseUp.fire(e);
viewOutgoingEvents.onMouseDrag = (e) => this._onMouseDrag.fire(e);
viewOutgoingEvents.onMouseDrop = (e) => this._onMouseDrop.fire(e);
viewOutgoingEvents.onMouseWheel = (e) => this._onMouseWheel.fire(e);
const viewUserInputEvents = new ViewUserInputEvents(viewModel.coordinatesConverter);
viewUserInputEvents.onKeyDown = (e) => this._onKeyDown.fire(e);
viewUserInputEvents.onKeyUp = (e) => this._onKeyUp.fire(e);
viewUserInputEvents.onContextMenu = (e) => this._onContextMenu.fire(e);
viewUserInputEvents.onMouseMove = (e) => this._onMouseMove.fire(e);
viewUserInputEvents.onMouseLeave = (e) => this._onMouseLeave.fire(e);
viewUserInputEvents.onMouseDown = (e) => this._onMouseDown.fire(e);
viewUserInputEvents.onMouseUp = (e) => this._onMouseUp.fire(e);
viewUserInputEvents.onMouseDrag = (e) => this._onMouseDrag.fire(e);
viewUserInputEvents.onMouseDrop = (e) => this._onMouseDrop.fire(e);
viewUserInputEvents.onMouseWheel = (e) => this._onMouseWheel.fire(e);
const view = new View(
commandDelegate,
this._configuration,
this._themeService,
viewModel,
viewOutgoingEvents
viewUserInputEvents
);
return [view, true];
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册