Fixed maximize drag and nested .rar extraction

This commit is contained in:
Geomitron
2020-03-09 10:52:41 -04:00
parent d7659554cc
commit 3a3c2b5476
7 changed files with 110 additions and 32 deletions

View File

@@ -1,4 +1,4 @@
import { Component, ViewChild } from '@angular/core'
import { Component, ViewChild, AfterViewInit } from '@angular/core'
import { ChartSidebarComponent } from './chart-sidebar/chart-sidebar.component'
import { StatusBarComponent } from './status-bar/status-bar.component'
import { SongResult } from 'src/electron/shared/interfaces/search.interface'
@@ -9,7 +9,7 @@ import { ResultTableComponent } from './result-table/result-table.component'
templateUrl: './browse.component.html',
styleUrls: ['./browse.component.scss']
})
export class BrowseComponent {
export class BrowseComponent implements AfterViewInit {
@ViewChild('resultTable', { static: true }) resultTable: ResultTableComponent
@ViewChild('chartSidebar', { static: true }) chartSidebar: ChartSidebarComponent
@@ -17,6 +17,24 @@ export class BrowseComponent {
constructor() { }
ngAfterViewInit() {
const $tableColumn = $('#table-column')
$tableColumn.visibility({
once: false,
continuous: true,
context: $tableColumn,
observeChanges: true,
onUpdate: () => {
let pos = $tableColumn[0].scrollTop + $tableColumn[0].offsetHeight
let max = $tableColumn[0].scrollHeight
if (pos >= max - 5) {
// TODO: load more results (should be debounced or something; wait until results have loaded before sending the request for more)
console.log('UPDATE SCROLL')
}
}
})
}
onResultsUpdated(results: SongResult[]) {
this.resultTable.results = results
this.resultTable.onNewSearch()
@@ -25,4 +43,8 @@ export class BrowseComponent {
this.statusBar.resultCount = results.length
this.statusBar.selectedResults = []
}
loadMoreResults() {
// TODO: use the same query as the current search, but append more results if there are any more to be viewed
}
}

View File

@@ -172,7 +172,7 @@ export class ChartSidebarComponent {
this.selectedVersion.versionID, {
avTagName: this.selectedVersion.avTagName,
artist: this.songResult.artist,
charter: this.selectedVersion.charters,
charter: this.selectedVersion.charters, //TODO: get the charter name associated with this particular version
links: JSON.parse(this.selectedVersion.downloadLink)
})
}

View File

@@ -6,7 +6,7 @@
<div class="right menu">
<a class="item traffic-light" (click)="minimize()"><i class="minus icon"></i></a>
<a class="item traffic-light" (click)="maximize()"><i class="icon window" [ngClass]="isMaximized ? 'restore' : 'maximize'"></i></a>
<a class="item traffic-light" (click)="toggleMaximized()"><i class="icon window" [ngClass]="isMaximized ? 'restore' : 'maximize'"></i></a>
<a class="item traffic-light" (click)="close()"><i class="x icon"></i></a>
</div>
</div>

View File

@@ -1,4 +1,4 @@
import { Component, OnInit } from '@angular/core'
import { Component, OnInit, ChangeDetectorRef } from '@angular/core'
import { ElectronService } from '../../core/services/electron.service'
@Component({
@@ -10,17 +10,25 @@ export class ToolbarComponent implements OnInit {
isMaximized: boolean
constructor(private electronService: ElectronService) { }
constructor(private electronService: ElectronService, private ref: ChangeDetectorRef) { }
ngOnInit() {
this.isMaximized = this.electronService.currentWindow.isMaximized()
this.electronService.currentWindow.on('unmaximize', () => {
this.isMaximized = false
this.ref.detectChanges()
})
this.electronService.currentWindow.on('maximize', () => {
this.isMaximized = true
this.ref.detectChanges()
})
}
minimize() {
this.electronService.currentWindow.minimize()
}
maximize() {
toggleMaximized() {
if (this.isMaximized) {
this.electronService.currentWindow.restore()
} else {