Skip to content

Commit

Permalink
Add some adjustments to extent trimmming to account for overscan expe…
Browse files Browse the repository at this point in the history
…riment

This isn't perfect, but it does fit shapes into the viewport a little better.
I dont think any of this code accounts for rotation either, needs more investigation.
  • Loading branch information
bhousel committed Apr 30, 2024
1 parent cd29674 commit ee6ddb9
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions modules/core/MapSystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -753,9 +753,12 @@ export class MapSystem extends AbstractSystem {
*/
trimmedExtent(extent) {
if (extent === undefined) {
const headerY = 71;
const headerY = 72;
const footerY = 30;
const pad = 10;
// Add 50px overscan experiment, see UISystem.js
// Maybe find a nicer way to include overscan and view padding into places like this.
// const pad = 10;
const pad = 70;
const viewport = this.context.viewport;
const [w, h] = viewport.dimensions;

Expand Down Expand Up @@ -805,8 +808,13 @@ export class MapSystem extends AbstractSystem {
* @return zoom
*/
trimmedExtentZoom(extent) {
const trimW = 40;
const trimH = 140;
// Add 50px overscan experiment, see UISystem.js
// Maybe find a nicer way to include overscan and view padding into places like this.
const trimW = 140;
const trimH = 240;
//const trimW = 40;
//const trimH = 140;

const viewport = this.context.viewport;
const trimmed = vecSubtract(viewport.dimensions, [trimW, trimH]);
return this.extentZoom(extent, trimmed);
Expand Down

0 comments on commit ee6ddb9

Please sign in to comment.