Skip to content
This repository has been archived by the owner on Dec 25, 2017. It is now read-only.

Commit

Permalink
Merge pull request #241 from l3tnun/devel
Browse files Browse the repository at this point in the history
/recorded の resize を少し遅らせる処理が正常に動作しない問題を修正
  • Loading branch information
l3tnun committed Jun 29, 2017
2 parents 858ae73 + 3d549a7 commit 75eb3d6
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions src_client/View/Recorded/RecordedView.ts
Expand Up @@ -31,7 +31,7 @@ class RecordedView extends ParentPageView {
private recordedMenuViewModel: RecordedMenuViewModel;
private recordedVideoLinkViewModel: RecordedVideoLinkDialogViewModel;
private recordedSearchMenuViewModel: RecordedSearchMenuViewModel;
private resizeListener = this.resize.bind(this);
private resizeListener = (() => { setTimeout(() => { this.resize() }, 100); }).bind(this);

private paginationComponent = new PaginationComponent();
private menuComponent = new MenuComponent();
Expand Down Expand Up @@ -116,7 +116,7 @@ class RecordedView extends ParentPageView {
oncreate: () => {
window.addEventListener("resize", this.resizeListener, false);
},
onupdate: () => { this.resize(0); },
onupdate: () => { this.resize(); },
onremove: () => {
window.removeEventListener("resize", this.resizeListener, false );
}
Expand All @@ -126,17 +126,15 @@ class RecordedView extends ParentPageView {
]);
}

private resize(wait: number = 100): void {
setTimeout(() => {
let element = <HTMLElement>document.getElementById(RecordedView.mainViewId);
if(element == null) { return; }
private resize(): void {
let element = <HTMLElement>document.getElementById(RecordedView.mainViewId);
if(element == null) { return; }

if(window.innerWidth <= RecordedView.gridChangeWidth) { element.style.width = ""; return; }
if(window.innerWidth <= RecordedView.gridChangeWidth) { element.style.width = ""; return; }

let width = Math.floor(window.innerWidth / RecordedView.gridCardWidth) * RecordedView.gridCardWidth || RecordedView.gridCardWidth;
let width = Math.floor(window.innerWidth / RecordedView.gridCardWidth) * RecordedView.gridCardWidth || RecordedView.gridCardWidth;

element.style.width = width + "px";
}, wait);
element.style.width = width + "px";
}

//カードリスト表示
Expand Down

0 comments on commit 75eb3d6

Please sign in to comment.