mirror of
https://github.com/openseadragon/openseadragon.git
synced 2025-01-31 15:12:07 +03:00
* Scroll view: go to current page when entering mode; clamp at first and last (m2)
This commit is contained in:
parent
70e461c214
commit
a470d10f4d
@ -1,7 +1,7 @@
|
||||
# To Do
|
||||
|
||||
* Scroll view: go to current page when entering mode; clamp at first and last
|
||||
|
||||
* Next/previous in scroll mode
|
||||
* Detect which page you're on in scroll mode (when switching to other modes)
|
||||
* Constraints
|
||||
* Thumbs: no zoom, no pan
|
||||
* Scroll: can't zoom out much, can't pan up and down
|
||||
@ -9,3 +9,4 @@
|
||||
* Resize on window resize
|
||||
* When going to thumbs, scroll to the proper part of the page
|
||||
* Show/hide pages?
|
||||
* Arrow keys
|
||||
|
@ -195,6 +195,8 @@
|
||||
|
||||
this.page = page;
|
||||
|
||||
var viewerWidth = this.$el.width();
|
||||
var viewerHeight = this.$el.height();
|
||||
var bounds = this.viewer.world.getItemAt(this.page).getBounds();
|
||||
var x = bounds.x;
|
||||
var y = bounds.y;
|
||||
@ -222,6 +224,17 @@
|
||||
y -= this.pageBuffer;
|
||||
width += (this.pageBuffer * 2);
|
||||
height += (this.pageBuffer * 2);
|
||||
|
||||
if (this.mode === 'scroll') {
|
||||
if (this.page === 0) {
|
||||
x = -this.pageBuffer;
|
||||
width = height * (viewerWidth / viewerHeight);
|
||||
} else if (this.page === this.viewer.world.getItemCount() - 1) {
|
||||
width = height * (viewerWidth / viewerHeight);
|
||||
x = (bounds.x + bounds.width + this.pageBuffer) - width;
|
||||
}
|
||||
}
|
||||
|
||||
this.viewer.viewport.fitBounds(new OpenSeadragon.Rect(x, y, width, height));
|
||||
|
||||
this.update();
|
||||
|
Loading…
x
Reference in New Issue
Block a user