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

Fix proposal for #929 #975

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
import { AnnotationGroup, TreeSortType } from "@iiif/manifold";
import { isVisible } from "../../../../Utils";
import { ContentLeftPanel as ContentLeftPanelConfig } from "../../extensions/config/ContentLeftPanel";
import { Dates } from "@edsilv/utils";

export class ContentLeftPanel extends LeftPanel<ContentLeftPanelConfig> {
$bottomOptions: JQuery;
Expand Down Expand Up @@ -52,6 +53,7 @@ export class ContentLeftPanel extends LeftPanel<ContentLeftPanelConfig> {
treeSortType: TreeSortType = TreeSortType.NONE;
treeView: TreeView;
thumbsRoot: Root;
thumbsCacheKey: string;

constructor($element: JQuery) {
super($element);
Expand All @@ -62,6 +64,8 @@ export class ContentLeftPanel extends LeftPanel<ContentLeftPanelConfig> {

super.create();

this.updateThumbsCacheKey();

this.extensionHost.subscribe(IIIFEvents.SETTINGS_CHANGE, () => {
this.render();
});
Expand Down Expand Up @@ -115,6 +119,12 @@ export class ContentLeftPanel extends LeftPanel<ContentLeftPanelConfig> {
this.updateTreeTabBySelection();
});

this.extensionHost.subscribe(IIIFEvents.LOGIN, () => {
this.updateThumbsCacheKey();
this.renderThumbs();
this.renderGallery();
});

// this.extensionHost.subscribe(
// OpenSeadragonExtensionEvents.PAGING_TOGGLED,
// (_paged: boolean) => {
Expand Down Expand Up @@ -246,6 +256,10 @@ export class ContentLeftPanel extends LeftPanel<ContentLeftPanelConfig> {
// );
// }

updateThumbsCacheKey(): void {
this.thumbsCacheKey = Dates.getTimeStamp().toString();
}

createTreeView(): void {
this.treeView = new TreeView(this.$treeView);
this.treeView.treeData = this.getTreeData();
Expand Down Expand Up @@ -457,9 +471,22 @@ export class ContentLeftPanel extends LeftPanel<ContentLeftPanelConfig> {
// height = this.config.options.oneColThumbHeight;
// }

const thumbs: Thumb[] = <Thumb[]>this.extension.helper.getThumbs(90);
let thumbs: Thumb[] = <Thumb[]>this.extension.helper.getThumbs(90);
// this.extension.helper.getThumbs(width, height)

thumbs = thumbs.map(
(t) => {
let u = new URL(t.uri)
if (u.search == '') {
u.search += '?_uv_t='+ this.thumbsCacheKey;
} else {
u.search += '&_uv_t='+ this.thumbsCacheKey;
}
t.uri = u.href;
return t;
}
);

if (
viewingDirection &&
viewingDirection === ViewingDirectionEnum.BOTTOM_TO_TOP
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ export class Auth1 {
// It can but wait.
const poll: number = window.setInterval(() => {
if (contentProviderWindow.closed) {
Auth1.publish(IIIFEvents.LOGIN);
window.clearInterval(poll);
resolve(true);
}
Expand Down