本文整理匯總了TypeScript中vs/base/browser/keyboardEvent.StandardKeyboardEvent.equals方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript StandardKeyboardEvent.equals方法的具體用法?TypeScript StandardKeyboardEvent.equals怎麽用?TypeScript StandardKeyboardEvent.equals使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類vs/base/browser/keyboardEvent.StandardKeyboardEvent
的用法示例。
在下文中一共展示了StandardKeyboardEvent.equals方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: StandardKeyboardEvent
this._register(domEvent(window, 'keydown', true)((e: KeyboardEvent) => {
const evt = new StandardKeyboardEvent(e);
if (evt.equals(KeyCode.Enter) || evt.equals(KeyCode.Space)) {
return;
}
let eventHandled = false;
if (this.buttonGroup) {
if (evt.equals(KeyMod.Shift | KeyCode.Tab) || evt.equals(KeyCode.LeftArrow)) {
focusedButton = focusedButton + this.buttonGroup.buttons.length - 1;
focusedButton = focusedButton % this.buttonGroup.buttons.length;
this.buttonGroup.buttons[focusedButton].focus();
eventHandled = true;
} else if (evt.equals(KeyCode.Tab) || evt.equals(KeyCode.RightArrow)) {
focusedButton++;
focusedButton = focusedButton % this.buttonGroup.buttons.length;
this.buttonGroup.buttons[focusedButton].focus();
eventHandled = true;
}
}
if (eventHandled) {
EventHelper.stop(e, true);
} else if (this.options.keyEventProcessor) {
this.options.keyEventProcessor(evt);
}
}));
示例2: StandardKeyboardEvent
this.$el.on(DOM.EventType.KEY_DOWN, (e: KeyboardEvent) => {
let event = new StandardKeyboardEvent(e);
let eventHandled = false;
if (this.enabled && event.equals(KeyCode.Enter) || event.equals(KeyCode.Space)) {
this.emit(DOM.EventType.CLICK, e);
eventHandled = true;
} else if (event.equals(KeyCode.Escape)) {
this.$el.domBlur();
eventHandled = true;
}
if (eventHandled) {
DOM.EventHelper.stop(event, true);
}
});
示例3: StandardKeyboardEvent
this.$el.on(DOM.EventType.KEY_DOWN, (e: KeyboardEvent) => {
let event = new StandardKeyboardEvent(e);
let eventHandled = false;
if (this.enabled && event.equals(CommonKeybindings.ENTER) || event.equals(CommonKeybindings.SPACE)) {
this.emit(DOM.EventType.CLICK, e);
eventHandled = true;
} else if (event.equals(CommonKeybindings.ESCAPE)) {
this.$el.domBlur();
eventHandled = true;
}
if (eventHandled) {
DOM.EventHelper.stop(event, true);
}
});
示例4: StandardKeyboardEvent
this._headerTabListener = DOM.addDisposableListener(this.header, DOM.EventType.KEY_DOWN, (e) => {
let event = new StandardKeyboardEvent(e);
if (event.equals(KeyCode.Tab) && this.state === CollapsibleState.EXPANDED) {
let element = this._table.getSelectedRows();
if (!element || element.length === 0) {
this._table.setSelectedRows([0]);
this._table.setActiveCell(0, 1);
e.stopImmediatePropagation();
}
}
});
示例5: StandardKeyboardEvent
this._register(domEvent(this.element, 'keydown', true)((e: KeyboardEvent) => {
const evt = new StandardKeyboardEvent(e);
if (evt.equals(KeyCode.Enter)) {
return;
}
if (this.buttonGroup) {
if ((evt.shiftKey && evt.equals(KeyCode.Tab)) || evt.equals(KeyCode.LeftArrow)) {
focusedButton = focusedButton + this.buttonGroup.buttons.length - 1;
focusedButton = focusedButton % this.buttonGroup.buttons.length;
this.buttonGroup.buttons[focusedButton].focus();
} else if (evt.equals(KeyCode.Tab) || evt.equals(KeyCode.RightArrow)) {
focusedButton++;
focusedButton = focusedButton % this.buttonGroup.buttons.length;
this.buttonGroup.buttons[focusedButton].focus();
}
}
EventHelper.stop(e, true);
}));
示例6: StandardKeyboardEvent
this.headerKeyListener = dom.addDisposableListener(this.header, dom.EventType.KEY_DOWN, (e) => {
let event = new StandardKeyboardEvent(e);
let eventHandled = false;
if (event.equals(CommonKeybindings.ENTER) || event.equals(CommonKeybindings.SPACE) || (event.equals(CommonKeybindings.LEFT_ARROW) && this.state === CollapsibleState.EXPANDED) || (event.equals(CommonKeybindings.RIGHT_ARROW) && this.state === CollapsibleState.COLLAPSED)) {
this.toggleExpansion();
eventHandled = true;
} else if (event.equals(CommonKeybindings.ESCAPE)) {
this.header.blur();
eventHandled = true;
} else if (event.equals(CommonKeybindings.UP_ARROW)) {
this.emit('focusPrevious');
eventHandled = true;
} else if (event.equals(CommonKeybindings.DOWN_ARROW)) {
this.emit('focusNext');
eventHandled = true;
}
if (eventHandled) {
dom.EventHelper.stop(event, true);
}
});
示例7: StandardKeyboardEvent
this._register(addDisposableListener(this._label, EventType.KEY_UP, e => {
const event = new StandardKeyboardEvent(e);
if (event.equals(KeyCode.Enter) || event.equals(KeyCode.Space)) {
EventHelper.stop(e, true); // https://github.com/Microsoft/vscode/issues/57997
if (this.visible) {
this.hide();
} else {
this.show();
}
}
}));
示例8: StandardKeyboardEvent
this.headerKeyListener = dom.addDisposableListener(this.header, dom.EventType.KEY_DOWN, (e) => {
let event = new StandardKeyboardEvent(e);
let eventHandled = false;
if (event.equals(KeyCode.Enter) || event.equals(KeyCode.Space) || (event.equals(KeyCode.LeftArrow) && this.state === CollapsibleState.EXPANDED) || (event.equals(KeyCode.RightArrow) && this.state === CollapsibleState.COLLAPSED)) {
this.toggleExpansion();
eventHandled = true;
} else if (event.equals(KeyCode.Escape)) {
this.header.blur();
eventHandled = true;
} else if (event.equals(KeyCode.UpArrow)) {
this.emit('focusPrevious');
eventHandled = true;
} else if (event.equals(KeyCode.DownArrow)) {
this.emit('focusNext');
eventHandled = true;
}
if (eventHandled) {
dom.EventHelper.stop(event, true);
}
});