Dispatch new dimensions with photoview resize, resize all layers

-Adds ability to resize OpenStreetCam and Bing Streetside layers
-Also slightly increases the width of the resize handles
-Also limits max resize so it won't go larger than the map
This commit is contained in:
Bryan Housel
2018-07-17 17:05:08 -04:00
parent b9a6996048
commit e221dcae58
4 changed files with 95 additions and 64 deletions
+27 -17
View File
@@ -34,17 +34,17 @@ import {
} from '../util';
var apibase = 'https://openstreetcam.org',
maxResults = 1000,
tileZoom = 14,
dispatch = d3_dispatch('loadedImages'),
imgZoom = d3_zoom()
.extent([[0, 0], [320, 240]])
.translateExtent([[0, 0], [320, 240]])
.scaleExtent([1, 15])
.on('zoom', zoomPan),
_oscCache,
_oscSelectedImage;
var apibase = 'https://openstreetcam.org';
var maxResults = 1000;
var tileZoom = 14;
var dispatch = d3_dispatch('loadedImages');
var imgZoom = d3_zoom()
.extent([[0, 0], [320, 240]])
.translateExtent([[0, 0], [320, 240]])
.scaleExtent([1, 15])
.on('zoom', zoomPan);
var _oscCache;
var _oscSelectedImage;
function abortRequest(i) {
@@ -129,12 +129,12 @@ function loadNextTilePage(which, currZoom, url, tile) {
var maxPages = maxPageAtZoom(currZoom);
var nextPage = cache.nextPage[tile.id] || 1;
var params = utilQsString({
ipp: maxResults,
page: nextPage,
// client_id: clientId,
bbTopLeft: [bbox.maxY, bbox.minX].join(','),
bbBottomRight: [bbox.minY, bbox.maxX].join(',')
}, true);
ipp: maxResults,
page: nextPage,
// client_id: clientId,
bbTopLeft: [bbox.maxY, bbox.minX].join(','),
bbBottomRight: [bbox.minY, bbox.maxX].join(',')
}, true);
if (nextPage > maxPages) return;
@@ -367,6 +367,16 @@ export default {
.attr('class', 'osc-image-wrap');
// Register viewer resize handler
context.ui().on('photoviewerResize', function(dimensions) {
imgZoom = d3_zoom()
.extent([[0, 0], dimensions])
.translateExtent([[0, 0], dimensions])
.scaleExtent([1, 15])
.on('zoom', zoomPan);
});
function rotate(deg) {
return function() {
if (!_oscSelectedImage) return;
+8
View File
@@ -669,6 +669,14 @@ export default {
.attr('src', context.asset(pannellumViewerJS));
// Register viewer resize handler
context.ui().on('photoviewerResize', function() {
if (_pannellumViewer) {
_pannellumViewer.resize();
}
});
function step(stepBy) {
return function() {
var viewer = d3_select('#photoviewer');