Skip to content
This repository was archived by the owner on Jul 4, 2025. It is now read-only.

Commit 47c21c6

Browse files
committed
clone canvas data
1 parent 4efdf2b commit 47c21c6

8 files changed

+102
-10
lines changed

dist/iiif-gallery-component.bundle.d.ts

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10029,3 +10029,86 @@ declare namespace Manifold {
1002910029
}
1003010030
}
1003110031

10032+
declare namespace IIIFComponents {
10033+
class GalleryComponent extends _Components.BaseComponent implements IGalleryComponent {
10034+
options: IGalleryComponentOptions;
10035+
private _$header;
10036+
private _$leftOptions;
10037+
private _$main;
10038+
private _$multiSelectOptions;
10039+
private _$rightOptions;
10040+
private _$selectAllButton;
10041+
private _$selectAllButtonCheckbox;
10042+
private _$selectButton;
10043+
private _$selectedThumb;
10044+
private _$sizeDownButton;
10045+
private _$sizeRange;
10046+
private _$sizeUpButton;
10047+
private _$thumbs;
10048+
private _lastThumbClickedIndex;
10049+
private _range;
10050+
private _scrollStopDuration;
10051+
private _thumbs;
10052+
private _thumbsCache;
10053+
constructor(options: IGalleryComponentOptions);
10054+
protected _init(): boolean;
10055+
protected _getDefaultOptions(): IGalleryComponentOptions;
10056+
databind(): void;
10057+
private _getMultiSelectState();
10058+
private _createThumbs();
10059+
private _getThumbByCanvas(canvas);
10060+
private _sizeThumb($thumb);
10061+
private _loadThumb($thumb, cb?);
10062+
private _getThumbsByRange(range);
10063+
private _updateThumbs();
10064+
private _getSelectedThumbIndex();
10065+
private _getAllThumbs();
10066+
private _getThumbByIndex(canvasIndex);
10067+
private _scrollToThumb(canvasIndex);
10068+
selectIndex(index: number): void;
10069+
private _setRange();
10070+
private _setThumbMultiSelected(thumb, selected);
10071+
protected _resize(): void;
10072+
}
10073+
}
10074+
declare namespace IIIFComponents.GalleryComponent {
10075+
class Events {
10076+
static DECREASE_SIZE: string;
10077+
static INCREASE_SIZE: string;
10078+
static MULTISELECTION_MADE: string;
10079+
static THUMB_SELECTED: string;
10080+
static THUMB_MULTISELECTED: string;
10081+
}
10082+
}
10083+
10084+
declare namespace IIIFComponents {
10085+
interface IGalleryComponent extends _Components.IBaseComponent {
10086+
selectIndex(index: number): void;
10087+
}
10088+
}
10089+
10090+
declare namespace IIIFComponents {
10091+
interface IContent {
10092+
searchResult: string;
10093+
searchResults: string;
10094+
select: string;
10095+
selectAll: string;
10096+
}
10097+
interface IGalleryComponentOptions extends _Components.IBaseComponentOptions {
10098+
chunkedResizingThreshold: number;
10099+
content: IContent;
10100+
debug: boolean;
10101+
helper: Manifold.IHelper;
10102+
imageFadeInDuration: number;
10103+
initialZoom: number;
10104+
minLabelWidth: number;
10105+
pageModeEnabled: boolean;
10106+
searchResults: Manifold.SearchResult[];
10107+
scrollStopDuration: number;
10108+
sizingEnabled: boolean;
10109+
thumbHeight: number;
10110+
thumbLoadPadding: number;
10111+
thumbWidth: number;
10112+
viewingDirection: Manifesto.ViewingDirection;
10113+
}
10114+
}

dist/iiif-gallery-component.bundle.js

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

dist/iiif-gallery-component.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// iiif-gallery-component v1.0.4 https://github.com/viewdir/iiif-gallery-component#readme
1+
// iiif-gallery-component v1.0.5 https://github.com/viewdir/iiif-gallery-component#readme
22

33
declare namespace IIIFComponents {
44
class GalleryComponent extends _Components.BaseComponent implements IGalleryComponent {

dist/iiif-gallery-component.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// iiif-gallery-component v1.0.4 https://github.com/viewdir/iiif-gallery-component#readme
1+
// iiif-gallery-component v1.0.5 https://github.com/viewdir/iiif-gallery-component#readme
22
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.iiifGalleryComponent = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
33
var __extends = (this && this.__extends) || function (d, b) {
44
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
@@ -161,7 +161,10 @@ var IIIFComponents;
161161
var searchResult = this.options.searchResults[i];
162162
// find the thumb with the same canvasIndex and add the searchResult
163163
var thumb = this._thumbs.en().where(function (t) { return t.index === searchResult.canvasIndex; }).first();
164-
thumb.data.searchResults = searchResult.rects.length;
164+
// clone the data so searchResults isn't persisted on the canvas.
165+
var data = $.extend(true, {}, thumb.data);
166+
data.searchResults = searchResult.rects.length;
167+
thumb.data = data;
165168
}
166169
}
167170
this._thumbsCache = null; // delete cache

dist/iiif-gallery-component.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/js/iiif-gallery-component.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// iiif-gallery-component v1.0.4 https://github.com/viewdir/iiif-gallery-component#readme
1+
// iiif-gallery-component v1.0.5 https://github.com/viewdir/iiif-gallery-component#readme
22
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.iiifGalleryComponent = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
33
var __extends = (this && this.__extends) || function (d, b) {
44
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
@@ -161,7 +161,10 @@ var IIIFComponents;
161161
var searchResult = this.options.searchResults[i];
162162
// find the thumb with the same canvasIndex and add the searchResult
163163
var thumb = this._thumbs.en().where(function (t) { return t.index === searchResult.canvasIndex; }).first();
164-
thumb.data.searchResults = searchResult.rects.length;
164+
// clone the data so searchResults isn't persisted on the canvas.
165+
var data = $.extend(true, {}, thumb.data);
166+
data.searchResults = searchResult.rects.length;
167+
thumb.data = data;
165168
}
166169
}
167170
this._thumbsCache = null; // delete cache

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "iiif-gallery-component",
3-
"version": "1.0.4",
3+
"version": "1.0.5",
44
"description": "",
55
"main": "index.js",
66
"scripts": {

src/GalleryComponent.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,10 @@ namespace IIIFComponents {
218218
// find the thumb with the same canvasIndex and add the searchResult
219219
let thumb: Manifold.IThumb = this._thumbs.en().where(t => t.index === searchResult.canvasIndex).first();
220220

221-
thumb.data.searchResults = searchResult.rects.length;
221+
// clone the data so searchResults isn't persisted on the canvas.
222+
let data = $.extend(true, {}, thumb.data);
223+
data.searchResults = searchResult.rects.length;
224+
thumb.data = data;
222225
}
223226

224227
}

0 commit comments

Comments
 (0)