提交 8dc5cec1 编写于 作者: I isidor

show alternative actions when alt is pressed, not only on mouse over

上级 9af426f0
......@@ -185,35 +185,23 @@ export class MenuItemActionItem extends ActionItem {
super.render(container);
this._updateItemClass(this._action.item);
let mouseOver = false;
const alternativeKeyEmitter = AlternativeKeyEmitter.getInstance(this._contextMenuService);
let alternativeKeyDown = alternativeKeyEmitter.isPressed;
const updateAltState = () => {
const wantsAltCommand = mouseOver && alternativeKeyDown;
if (wantsAltCommand !== this._wantsAltCommand) {
this._wantsAltCommand = wantsAltCommand;
if (alternativeKeyDown !== this._wantsAltCommand) {
this._wantsAltCommand = alternativeKeyDown;
this._updateLabel();
this._updateTooltip();
this._updateClass();
}
};
updateAltState();
this._callOnDispose.push(alternativeKeyEmitter.event(value => {
alternativeKeyDown = value;
updateAltState();
}));
this._callOnDispose.push(domEvent(container, 'mouseleave')(_ => {
mouseOver = false;
updateAltState();
}));
this._callOnDispose.push(domEvent(container, 'mouseenter')(e => {
mouseOver = true;
updateAltState();
}));
}
_updateLabel(): void {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册