Skip to content

Commit

Permalink
Use multi-select values of contentPreference sent by mapml-extension
Browse files Browse the repository at this point in the history
(relies on M.options.contentPreference being an array).
  • Loading branch information
prushforth committed Nov 6, 2024
1 parent 6ebe283 commit a5e3c89
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions src/mapml-viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -995,13 +995,6 @@ export class HTMLMapmlViewerElement extends HTMLElement {

// less obviously useful: aspect-ratio, orientation, (device) resolution, overflow-block, overflow-inline

const currentBounds = [
this.extent.topLeft.pcrs.horizontal,
this.extent.bottomRight.pcrs.vertical,
this.extent.bottomRight.pcrs.horizontal,
this.extent.topLeft.pcrs.vertical
];

const features = {
'prefers-lang': {
type: 'discrete',
Expand Down Expand Up @@ -1031,9 +1024,9 @@ export class HTMLMapmlViewerElement extends HTMLElement {
: 'light'
]
},
'map-extent': {
'prefers-map-content': {
type: 'discrete',
values: currentBounds
values: M.options.contentPreference
}
};

Expand All @@ -1056,10 +1049,10 @@ export class HTMLMapmlViewerElement extends HTMLElement {
return features['prefers-color-scheme'].values
.some((s) => s === queryValue)
.toString();
} else if (feature === 'map-extent') {
// const [x1, y1, x2, y2] = queryValue.split(',').map(Number);
// let queryBounds = bounds([x1, y1], [x2, y2]);
return 'false';
} else if (feature === 'prefers-map-content') {
return features[feature].values
.some((pref) => pref === queryValue)
.toString();
}

return 'false';
Expand Down

0 comments on commit a5e3c89

Please sign in to comment.