Skip to content

Commit

Permalink
merged with origin
Browse files Browse the repository at this point in the history
  • Loading branch information
mattiapezzotti committed Aug 8, 2024
2 parents 93c35cf + ba8d52e commit 8f8f0cb
Show file tree
Hide file tree
Showing 8 changed files with 83 additions and 56 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ _Breaking developer changes, which may affect downstream projects or sites that
#### :scissors: Operations
#### :camera: Street-Level
* Add Panoramax as new street level imagery provider ([#9941], thanks [@mattiapezzotti])
* Fix intermittent issues with Bing Streetside sometimes returning API results in a undocumented format ([#10341])
#### :white_check_mark: Validation
#### :bug: Bugfixes
* Fix bug which required a second button click when resolving/reopening of OSM notes ([#8994], thanks [@laigyu])
Expand Down
5 changes: 4 additions & 1 deletion modules/services/pannellum_photo.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ export default {

const options = {
'default': { firstScene: '' },
scenes: {}
scenes: {},
minHfov: 20
};

_pannellumViewer = window.pannellum.viewer('ideditor-pannellum-viewer', options);
Expand Down Expand Up @@ -147,6 +148,8 @@ export default {
_pannellumViewer.removeScene(old_key);
}

_pannellumViewer.resize();

return this;
},

Expand Down
18 changes: 14 additions & 4 deletions modules/services/panoramax.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,18 @@ function searchLimited(limit, projection, rtree) {

return partitionViewport(projection)
.reduce(function(result, extent) {
const found = rtree.search(extent.bbox())
let found = rtree.search(extent.bbox());
const spacing = Math.max(1, Math.floor(found.length / limit));
found = found
.filter((d, idx) => idx % spacing === 0 ||
d.data.id === _activeImage?.id)
.sort((a, b) => {
if (a.data.id === _activeImage?.id) return -1;
if (b.data.id === _activeImage?.id) return 1;
return 0;
})
.slice(0, limit)
.map(function(d) { return d.data; });
.map(d => d.data);

return (found.length ? result.concat(found) : result);
}, []);
Expand Down Expand Up @@ -147,6 +156,7 @@ function loadTileDataToCache(data, tile, zoom) {
d = {
loc: loc,
capture_time: feature.properties.ts,
capture_time_parsed: new Date(feature.properties.ts),
id: feature.properties.id,
account_id: feature.properties.account_id,
sequence_id: feature.properties.sequences.split('\"')[1],
Expand Down Expand Up @@ -468,8 +478,8 @@ export default {
_currentFrame = d.isPano ? _pannellumFrame : _planeFrame;

_currentFrame
.selectPhoto(d, true)
.showPhotoFrame(wrap);
.showPhotoFrame(wrap)
.selectPhoto(d, true);
});

function localeDateString(s) {
Expand Down
8 changes: 6 additions & 2 deletions modules/services/streetside.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,14 +114,18 @@ function loadNextTilePage(which, url, tile) {
const bubbleId = bubble.imageUrl;
if (cache.points[bubbleId]) return null; // skip duplicates

const loc = [bubble.lon, bubble.lat];
// workaround for https://github.com/openstreetmap/iD/issues/10341#issuecomment-2275724738
const loc = [
bubble.lon || bubble.longitude,
bubble.lat || bubble.latitude
];
const d = {
loc: loc,
key: bubbleId,
imageUrl: bubble.imageUrl.replace('{subdomain}',
bubble.imageUrlSubdomains[0]
),
ca: bubble.he,
ca: bubble.he || bubble.heading,
captured_at: bubble.vintageEnd,
captured_by: 'microsoft',
pano: true,
Expand Down
21 changes: 15 additions & 6 deletions modules/svg/panoramax_images.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,12 @@ export function svgPanoramaxImages(projection, context, dispatch) {
.on('end', editOff);
}

function transform(d) {
function transform(d, selectedImageId) {
let t = svgPointTransform(projection)(d);
var rot = d.heading + _viewerYaw;
let rot = d.heading;
if (d.id === selectedImageId) {
rot += _viewerYaw;
}
if (rot) {
t += ' rotate(' + Math.floor(rot) + ',0,0)';
}
Expand Down Expand Up @@ -208,7 +211,7 @@ export function svgPanoramaxImages(projection, context, dispatch) {

const service = getService();
let sequences = (service ? service.sequences(projection, zoom) : []);
let images = (service ? service.images(projection) : []);
let images = (service && zoom >= imageMinZoom ? service.images(projection) : []);

images = await filterImages(images);
sequences = await filterSequences(sequences, service);
Expand Down Expand Up @@ -246,13 +249,18 @@ export function svgPanoramaxImages(projection, context, dispatch) {
.append('g')
.attr('class', 'viewfield-scale');

const activeImageId = service.getActiveImage()?.id;
// update
const markers = groups
.merge(groupsEnter)
.sort(function(a, b) {
return b.loc[1] - a.loc[1]; // sort Y
// active image on top
if (a.id === activeImageId) return 1;
if (b.id === activeImageId) return -1;
// else: sort by capture time (newest on top)
return a.capture_time_parsed - b.capture_time_parsed;
})
.attr('transform', transform)
.attr('transform', d => transform(d, activeImageId))
.select('.viewfield-scale');


Expand Down Expand Up @@ -292,6 +300,7 @@ export function svgPanoramaxImages(projection, context, dispatch) {
if (!service) return;

const frame = service.photoFrame();
if (!frame) return;

// update viewfield rotation
_viewerYaw = frame.getYaw();
Expand All @@ -301,7 +310,7 @@ export function svgPanoramaxImages(projection, context, dispatch) {
if (context.map().isTransformed()) return;

layer.selectAll('.viewfield-group.currentView')
.attr('transform', transform);
.attr('transform', d => transform(d, d.id));
}


Expand Down
72 changes: 36 additions & 36 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,13 @@
"abortcontroller-polyfill": "^1.7.5",
"aes-js": "^3.1.2",
"alif-toolkit": "^1.3.0",
"core-js-bundle": "^3.37.1",
"core-js-bundle": "^3.38.0",
"diacritics": "1.3.0",
"exifr": "^7.1.3",
"fast-deep-equal": "~3.1.1",
"fast-json-stable-stringify": "2.1.0",
"lodash-es": "~4.17.15",
"marked": "~13.0.3",
"marked": "~14.0.0",
"node-diff3": "~3.1.0",
"osm-auth": "~2.5.0",
"pannellum": "2.5.6",
Expand All @@ -79,9 +79,9 @@
"@mapbox/maki": "^8.0.1",
"@openstreetmap/id-tagging-schema": "^6.7.3",
"@rapideditor/mapillary_sprite_source": "^1.8.0",
"@rapideditor/temaki": "^5.8.0",
"@transifex/api": "^7.1.0",
"autoprefixer": "^10.4.19",
"@rapideditor/temaki": "^5.9.0",
"@transifex/api": "^7.1.2",
"autoprefixer": "^10.4.20",
"browserslist": "^4.23.3",
"browserslist-to-esbuild": "^2.1.1",
"chai": "^4.5.0",
Expand Down Expand Up @@ -112,7 +112,7 @@
"name-suggestion-index": "~6.0",
"npm-run-all": "^4.0.0",
"osm-community-index": "~5.8.0",
"postcss": "^8.4.40",
"postcss": "^8.4.41",
"postcss-selector-prepend": "^0.5.0",
"shelljs": "^0.8.0",
"shx": "^0.3.0",
Expand Down
2 changes: 1 addition & 1 deletion scripts/build_data.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ function buildData() {
});
}).then(() =>
// also fetch the bleeding edge data too to make sure we're always hosting the latest icons
fetch('https://github.com/raw/openstreetmap/id-tagging-schema/main/interim/icons.json')
fetch('https://github.com/raw/openstreetmap/id-tagging-schema/interim/icons.json')
).then(response => response.json()).then(cuttingEdgeIcons => {
cuttingEdgeIcons
.filter(icon => /^fa[srb]-/.test(icon))
Expand Down

0 comments on commit 8f8f0cb

Please sign in to comment.