CoreMouseService
This commit is contained in:
Vendored
+61
@@ -158,3 +158,64 @@ export interface IRowRange {
|
||||
start: number;
|
||||
end: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface for mouse events in the core.
|
||||
*/
|
||||
export interface ICoreMouseEvent {
|
||||
/** column (zero based). */
|
||||
col: number;
|
||||
/** row (zero based). */
|
||||
row: number;
|
||||
/**
|
||||
* Button the action occured. Due to restrictions of the tracking protocols
|
||||
* it is not possible to report multiple buttons at once.
|
||||
* Wheel is treated as a button.
|
||||
* There are invalid combinations of buttons and actions possible
|
||||
* (like move + wheel), those are silently ignored by the CoreMouseService.
|
||||
*/
|
||||
button: 'left' | 'middle' | 'right' | 'wheel' | 'none';
|
||||
action: 'up' | 'down' | 'move';
|
||||
/**
|
||||
* Modifier states.
|
||||
* Protocols will add/ignore those based on specific restrictions.
|
||||
*/
|
||||
ctrl?: boolean;
|
||||
alt?: boolean;
|
||||
shift?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* CoreMouseEventType
|
||||
* To be reported to the browser component which events a mouse
|
||||
* protocol wants to be catched and forwarded as an ICoreMouseEvent
|
||||
* to CoreMouseService.
|
||||
* Known types:
|
||||
* - mousedown: any mousedown event
|
||||
* - mouseup: any mouseup event
|
||||
* - wheel: any wheel event
|
||||
* - mousedrag: any mousemove event while a button is pressed
|
||||
* - mousemove: any mousemove event
|
||||
*/
|
||||
export type CoreMouseEventType = 'mousedown' | 'mouseup' | 'wheel' | 'mousemove' | 'mousedrag';
|
||||
|
||||
/**
|
||||
* Mouse protocol interface.
|
||||
* A mouse protocol can be registered and activated at the CoreMouseService.
|
||||
* `events` should contain a list of needed events as a hint for the browser component
|
||||
* to install/remove the appropriate event handlers.
|
||||
* `restrict` applies further protocol specific restrictions like not allowed
|
||||
* modifiers or filtering invalid event types.
|
||||
*/
|
||||
export interface ICoreMouseProtocol {
|
||||
events: CoreMouseEventType[];
|
||||
restrict: (e: ICoreMouseEvent) => boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* CoreMouseEncoding
|
||||
* The tracking encoding can be registered and activated at the CoreMouseService.
|
||||
* If a ICoreMouseEvent passes all procotol restrictions it will be encoded
|
||||
* with the active encoding and sent out.
|
||||
*/
|
||||
export type CoreMouseEncoding = (event: ICoreMouseEvent) => string;
|
||||
|
||||
Reference in New Issue
Block a user