Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(worldview) montage requires preview size to match resolution #207

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion examples/worldview/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ yarn
```

#### 2. Mapbox Token

Add mapbox access token to env.

```sh
Expand All @@ -19,4 +20,4 @@ export MapboxAccessToken=<your_mapbox_token>

```sh
yarn start-local
```
```
2 changes: 1 addition & 1 deletion examples/worldview/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@
"webpack-hot-middleware": "^2.24.3"
},
"resolutions": {
"mapbox-gl": "2.4.1"
"mapbox-gl": "2.5.1"
}
}
8 changes: 4 additions & 4 deletions examples/worldview/src/app/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,14 @@ const WindowSize = styled.div`

const KEPLER_MAP_ID = 'map';
const selectMapStyle = createSelectMapStyle(KEPLER_MAP_ID);
const sceneLayers = [];
let sceneLayers = [];
const App = ({}) => {
useScene();
sceneLayers = useScene();
const keplerDeckLayers = useKeplerDeckLayers(KEPLER_MAP_ID);
const deckProps = useMemo(() => {
return {
// layers: [...keplerDeckLayers, ...sceneLayers]
layers: [...sceneLayers, ...keplerDeckLayers]
layers: [...keplerDeckLayers, ...sceneLayers]
// layers: [...sceneLayers, ...keplerDeckLayers]
// layers: []
// layers: keplerDeckLayers
};
Expand Down
4 changes: 2 additions & 2 deletions examples/worldview/src/features/map/Map.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,11 @@ export class Map extends Component {

const canvasClientSize = getCanvasClientSize(resolution, viewportMinAxis);
// canvasClientSize * scalar = previewSize
const scalar = scale(previewSize, canvasClientSize);
// const scalar = scale(previewSize, canvasClientSize);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this only needs to be disabled for mapbox 2.5, but could still be used with 2.4 - can you treat previewSize as optional, where if it's provided then it should do this scaling and size the CSS container variable using previewSize. Otherwise (in the 2.5 case), don't scale and actually set the container size using the canvasSize variable?

const deckStyle = {
width: `${canvasClientSize.width}px`,
height: `${canvasClientSize.height}px`,
transform: `scale(${scalar})`,
// transform: `scale(${scalar})`,
transformOrigin: 'top left'
};

Expand Down
2 changes: 1 addition & 1 deletion examples/worldview/src/features/map/MapContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export const MapContainer = ({previewSize, deckProps, staticMapProps, debug, vie
resolution={resolution}
updateTimeCursor={timeMs => dispatch(updateTimeCursor(timeMs))}
debug={debug}
viewportMinAxis={viewportMinAxis}
viewportMinAxis={Math.min(resolution.width, resolution.height)}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we make this so that if the viewportMinAxis prop is provided it uses that, otherwise does this? There are situations where either is used.

/>
);
};
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@
"prettier": "^1.18.2",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-map-gl": "^5.2.10",
"react-intl": "^3.12.0",
"react-map-gl": "^5.2.10",
"react-redux": "^7.1.3",
"react-virtualized": "^9.21.0",
"styled-components": "^4.4.1"
Expand Down
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4248,9 +4248,9 @@ camelize@^1.0.0:
integrity sha1-FkpUg+Yw+kMh5a8HAg5TGDGyYJs=

caniuse-lite@^1.0.30001219:
version "1.0.30001230"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001230.tgz#8135c57459854b2240b57a4a6786044bdc5a9f71"
integrity sha512-5yBd5nWCBS+jWKTcHOzXwo5xzcj4ePE/yjtkZyUV1BTUmrBaA9MRGC+e7mxnqXSA90CmCA8L3eKLaSUkt099IQ==
version "1.0.30001277"
resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001277.tgz"
integrity sha512-J2WtYj2Pl6LBEG214XmbGw1gzZEsYuinQFPqYtpZDB3/vm49qNlrcbJrTMkHKmdRDdmXYwkG0tgOBJsuI+J12Q==

capture-stack-trace@^1.0.0:
version "1.0.1"
Expand Down