Skip to content

Commit ef1eada

Browse files
authored
Feat: Implement window dragging functionality with new directive (#1042)
* Feat: Implement window dragging functionality with new directive * Refactor: Update window dragging implementation and remove unused drag areas
1 parent 70e1989 commit ef1eada

20 files changed

Lines changed: 129 additions & 32 deletions

src/app/app.module.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ import { WelcomeComponent } from './ui/components/welcome/welcome.component';
146146
import { WindowControlsComponent } from './ui/components/window-controls/window-controls.component';
147147
import { CdkVirtualScrollViewportPatchDirective } from './ui/directives/cdk-virtual-scroll-viewport-patch-directive';
148148
import { WebviewDirective } from './ui/directives/webview.directive';
149+
import { WindowDraggableDirective } from './ui/directives/window-draggable.directive';
149150
import { GlobalErrorHandler } from './globalErrorHandler';
150151
import { AlbumsFilterPipe } from './ui/pipes/albums-filter.pipe';
151152
import { FolderNamePipe } from './ui/pipes/folder-name.pipe';
@@ -344,6 +345,7 @@ export function settingsInitializerFactory(settings: SettingsBase) {
344345
declarations: [
345346
AppComponent,
346347
WebviewDirective,
348+
WindowDraggableDirective,
347349
CdkVirtualScrollViewportPatchDirective,
348350
WelcomeComponent,
349351
CollectionComponent,

src/app/ui/components/collection/collection.component.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<div class="window-frame">
2-
<div class="window-frame__titlebar theme-header-background">
2+
<div class="window-frame__titlebar theme-header-background" appWindowDraggable>
33
<div *ngIf="appearanceService.needsTrafficLightMargin" class="window-frame__trafficlights"></div>
4-
<app-logo-small class="m-2 draggable"></app-logo-small>
4+
<app-logo-small class="m-2"></app-logo-small>
55
<app-sub-menu>
66
<app-sub-menu-item *ngIf="settings.showArtistsPage" [page]="0" [selectedPage]="this.page" (click)="this.setPage(0)">
77
{{ 'artists' | translate }}
@@ -22,7 +22,7 @@
2222
{{ 'folders' | translate }}
2323
</app-sub-menu-item>
2424
</app-sub-menu>
25-
<div class="window-frame__dragarea"></div>
25+
<div class="window-frame__spacer"></div>
2626
<app-search-box class="p-2"></app-search-box>
2727
<app-main-menu></app-main-menu>
2828
<app-switch-player-button></app-switch-player-button>

src/app/ui/components/highlights/highlights.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<div class="window-frame">
2-
<div class="window-frame__titlebar">
2+
<div class="window-frame__titlebar" appWindowDraggable>
33
<div *ngIf="appearanceService.needsTrafficLightMargin" class="window-frame__trafficlights"></div>
44
<div class="window-button back-button" (click)="this.goBackToCollectionAsync()" [@controlsVisibility]="controlsVisibility">
55
<i class="back-button__icon las la-arrow-left"></i>
66
</div>
7-
<div class="window-frame__dragarea"></div>
7+
<div class="window-frame__spacer"></div>
88
<app-switch-player-button [@controlsVisibility]="controlsVisibility"></app-switch-player-button>
99
<app-window-controls
1010
*ngIf="appearanceService.needsCustomWindowControls"

src/app/ui/components/information/information.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<div class="window-frame">
2-
<div class="window-frame__titlebar theme-header-background">
2+
<div class="window-frame__titlebar theme-header-background" appWindowDraggable>
33
<div *ngIf="appearanceService.needsTrafficLightMargin" class="window-frame__trafficlights"></div>
44
<app-back-button class="m-2"></app-back-button>
55
<app-sub-menu>
@@ -10,7 +10,7 @@
1010
{{ 'components' | translate }}
1111
</app-sub-menu-item>
1212
</app-sub-menu>
13-
<div class="window-frame__dragarea"></div>
13+
<div class="window-frame__spacer"></div>
1414
<app-main-menu></app-main-menu>
1515
<app-switch-player-button></app-switch-player-button>
1616
<app-window-controls *ngIf="appearanceService.needsCustomWindowControls"></app-window-controls>

src/app/ui/components/loading/loading.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<div class="window-frame">
2-
<div class="window-frame__titlebar">
2+
<div class="window-frame__titlebar" appWindowDraggable>
33
<div *ngIf="appearanceService.needsTrafficLightMargin" class="window-frame__trafficlights"></div>
4-
<div class="window-frame__dragarea"></div>
4+
<div class="window-frame__spacer"></div>
55
<app-window-controls *ngIf="appearanceService.needsCustomWindowControls"></app-window-controls>
66
</div>
77
<div class="window-frame__content">

src/app/ui/components/main-menu/main-menu.component.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@
1818
<div *ngIf="this.updateService.isUpdateAvailable">
1919
<mat-divider></mat-divider>
2020
<button mat-menu-item (click)="downloadLatestReleaseAsync()">
21-
<div class="accent-color">{{ 'download-action' | translate }} {{ this.applicationName }} {{ this.updateService.latestRelease }}</div>
21+
<div class="accent-color">
22+
{{ 'download-action' | translate }} {{ this.applicationName }} {{ this.updateService.latestRelease }}
23+
</div>
2224
</button>
2325
</div>
2426
</mat-menu>

src/app/ui/components/main-menu/main-menu.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { UpdateServiceBase } from '../../../services/update/update.service.base'
55

66
@Component({
77
selector: 'app-main-menu',
8-
host: { style: 'display: block' },
8+
host: { style: 'display: block, -webkit-app-region: no-drag' },
99
templateUrl: './main-menu.component.html',
1010
styleUrls: ['./main-menu.component.scss'],
1111
encapsulation: ViewEncapsulation.None,

src/app/ui/components/manage-collection/manage-collection.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<div class="window-frame">
2-
<div class="window-frame__titlebar theme-header-background">
2+
<div class="window-frame__titlebar theme-header-background" appWindowDraggable>
33
<div *ngIf="appearanceService.needsTrafficLightMargin" class="window-frame__trafficlights"></div>
44
<app-back-button class="m-2"></app-back-button>
55
<app-sub-menu>
@@ -13,7 +13,7 @@
1313
{{ 'albums' | translate }}
1414
</app-sub-menu-item>
1515
</app-sub-menu>
16-
<div class="window-frame__dragarea"></div>
16+
<div class="window-frame__spacer"></div>
1717
<app-main-menu></app-main-menu>
1818
<app-switch-player-button></app-switch-player-button>
1919
<app-window-controls *ngIf="appearanceService.needsCustomWindowControls"></app-window-controls>

src/app/ui/components/mini-players/cover-player/cover-player.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<div class="cover-player__titlebar" [ngClass]="{ draggable: !this.playbackQueueIsVisible }" [@controlsVisibility]="controlsVisibility">
1+
<div class="cover-player__titlebar" [@controlsVisibility]="controlsVisibility" appWindowDraggable>
22
<div class="d-flex flex-grow"></div>
33
<div class="d-flex">
44
<app-switch-player-button [highContrast]="true"></app-switch-player-button>

src/app/ui/components/now-playing/now-playing.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@
1010
[@background2Animation]="background2Animation"
1111
></div>
1212
<div class="window-frame">
13-
<div class="window-frame__titlebar">
13+
<div class="window-frame__titlebar" appWindowDraggable>
1414
<div *ngIf="appearanceService.needsTrafficLightMargin" class="window-frame__trafficlights"></div>
1515
<div class="window-button back-button" (click)="this.goBackToCollectionAsync()" [@controlsVisibility]="controlsVisibility">
1616
<i class="back-button__icon las la-arrow-left"></i>
1717
</div>
18-
<div class="window-frame__dragarea"></div>
18+
<div class="window-frame__spacer"></div>
1919
<app-switch-player-button [@controlsVisibility]="controlsVisibility"></app-switch-player-button>
2020
<app-window-controls
2121
*ngIf="appearanceService.needsCustomWindowControls"

0 commit comments

Comments
 (0)