Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP]: Move Debug Actions Widget to the Debug Viewlet #49099

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 0 additions & 35 deletions src/vs/workbench/parts/debug/browser/debugActionsWidget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ export const debugToolBarBorder = registerColor('debugToolBar.border', {
export class DebugActionsWidget extends Themable implements IWorkbenchContribution {

private $el: Builder;
private dragArea: Builder;
private actionBar: ActionBar;
private allActions: AbstractDebugAction[];
private activeActions: AbstractDebugAction[];
Expand All @@ -71,8 +70,6 @@ export class DebugActionsWidget extends Themable implements IWorkbenchContributi
super(themeService);

this.$el = $().div().addClass('debug-actions-widget').style('top', `${partService.getTitleBarOffset()}px`);
this.dragArea = $().div().addClass('drag-area');
this.$el.append(this.dragArea);

const actionBarContainter = $().div().addClass('.action-bar-container');
this.$el.append(actionBarContainter);
Expand Down Expand Up @@ -136,42 +133,10 @@ export class DebugActionsWidget extends Themable implements IWorkbenchContributi
}));
$(window).on(dom.EventType.RESIZE, () => this.setXCoordinate(), this.toUnbind);

this.dragArea.on(dom.EventType.MOUSE_UP, (event: MouseEvent) => {
const mouseClickEvent = new StandardMouseEvent(event);
if (mouseClickEvent.detail === 2) {
// double click on debug bar centers it again #8250
const widgetWidth = this.$el.getHTMLElement().clientWidth;
this.setXCoordinate(0.5 * window.innerWidth - 0.5 * widgetWidth);
this.storePosition();
}
});

this.dragArea.on(dom.EventType.MOUSE_DOWN, (event: MouseEvent) => {
const $window = $(window);
this.dragArea.addClass('dragged');

$window.on('mousemove', (e: MouseEvent) => {
const mouseMoveEvent = new StandardMouseEvent(e);
// Prevent default to stop editor selecting text #8524
mouseMoveEvent.preventDefault();
// Reduce x by width of drag handle to reduce jarring #16604
this.setXCoordinate(mouseMoveEvent.posx - 14);
}).once('mouseup', (e: MouseEvent) => {
this.storePosition();
this.dragArea.removeClass('dragged');
$window.off('mousemove');
});
});

this.toUnbind.push(this.partService.onTitleBarVisibilityChange(() => this.positionDebugWidget()));
this.toUnbind.push(browser.onDidChangeZoomLevel(() => this.positionDebugWidget()));
}

private storePosition(): void {
const position = parseFloat(this.$el.getComputedStyle().left) / window.innerWidth;
this.storageService.store(DEBUG_ACTIONS_WIDGET_POSITION_KEY, position, StorageScope.WORKSPACE);
}

protected updateStyles(): void {
super.updateStyles();

Expand Down