Skip to content

Commit

Permalink
Allow export of Composited Image
Browse files Browse the repository at this point in the history
Add a third option to export button select, COMPOSITED, which handles split/side (css clipPath) and css mixBlendModes
  • Loading branch information
jo-chemla committed Jun 27, 2024
1 parent 172dcef commit d094084
Show file tree
Hide file tree
Showing 6 changed files with 239 additions and 153 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"@tmcw/togeojson": "^5.6.0",
"date-fns": "^2.30.0",
"dayjs": "^1.11.7",
"html-to-image": "^1.11.11",
"mapbox-gl": "^2.14.1",
"mapbox-gl-controls": "^2.3.5",
"react": "^18.2.0",
Expand Down
42 changes: 42 additions & 0 deletions pnpm-lock.yaml

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

7 changes: 4 additions & 3 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@ function App() {
></div>
</Split>
</div>
<div style={{position: 'absolute', inset: '0'}} id={'mapsParent'} >
<Map
{...sharedMapsProps}
hash={true}
Expand Down Expand Up @@ -437,7 +438,6 @@ function App() {
{/* beforeId={"GROUP_"} */}
<ScaleControl maxWidth={60} unit="metric" position={'top-left'}/>
</Map>
<>
<div
style={RightMapStyle}
>
Expand Down Expand Up @@ -488,12 +488,13 @@ function App() {
</Map>
{(splitScreenMode !== "split-screen") && (
<canvas
preserveDrawingBuffer = {true}
style={
{...RightMapStyle,
pointerEvents: 'none',
// backgroundColor: 'red',
mixBlendMode: blendingActivation ? blendingMode : "normal",
opacity: opacity,
opacity: blendingMode !== 'normal' ? opacity : 0,
display: blendingActivation ? 'block' : 'none',
...{top: 0, bottom: 0, left: 0, right: 0, },
margin: '0 auto',
Expand All @@ -507,7 +508,7 @@ function App() {
</canvas>
)}
</div>
</>
</div>
<ControlPanel
// Adding blending mode opacity, and blending mode activation to pass downward
blendingActivation={blendingActivation}
Expand Down
4 changes: 3 additions & 1 deletion src/blending-control.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ const BlendingControl = (props:any) => {
];

const handleBlendingModeChange = (event:any) => {
props.setBlendingMode(event.target.value);
const mode = event.target.value;
props.setBlendingMode(mode);
if (mode !== 'normal') props.setBlendingActivation(true)
};

return (
Expand Down
Loading

0 comments on commit d094084

Please sign in to comment.