Skip to content

Commit

Permalink
Merge pull request #1464 from OskarDamkjaer/more_zoom
Browse files Browse the repository at this point in the history
Increase zoom limits and individual steps
  • Loading branch information
OskarDamkjaer authored Jul 15, 2021
2 parents 80d05cd + a7be027 commit 885d99a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/browser/modules/D3Visualization/components/Graph.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export class GraphComponent extends Component<any, State> {
graphView: any
svgElement: any
state = {
zoomInLimitReached: true,
zoomInLimitReached: false,
zoomOutLimitReached: false
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ const vizFn = function(

const zoomBehavior = d3.behavior
.zoom()
.scaleExtent([0.2, 1])
.scaleExtent([0.1, 2])
.on('zoom', zoomed)

const interpolateZoom = (translate: any, scale: any) =>
Expand Down Expand Up @@ -131,15 +131,15 @@ const vizFn = function(
const limitsReached = { zoomInLimit: false, zoomOutLimit: false }

if (isZoomingIn) {
zoomLevel = Number((zoomBehavior.scale() * (1 + 0.2 * 1)).toFixed(2))
zoomLevel = Number((zoomBehavior.scale() * (1 + 0.3 * 1)).toFixed(2))
if (zoomLevel >= zoomBehavior.scaleExtent()[1]) {
limitsReached.zoomInLimit = true
interpolateZoom(zoomBehavior.translate(), zoomBehavior.scaleExtent()[1])
} else {
interpolateZoom(zoomBehavior.translate(), zoomLevel)
}
} else {
zoomLevel = Number((zoomBehavior.scale() * (1 + 0.2 * -1)).toFixed(2))
zoomLevel = Number((zoomBehavior.scale() * (1 + 0.3 * -1)).toFixed(2))
if (zoomLevel <= zoomBehavior.scaleExtent()[0]) {
limitsReached.zoomOutLimit = true
interpolateZoom(zoomBehavior.translate(), zoomBehavior.scaleExtent()[0])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ exports[`Visualization renders with result and escapes any HTML 1`] = `
class="sc-eHgmQL fBSINn"
>
<button
class="sc-cvbbAY cqXpvD faded zoom-in"
class="sc-cvbbAY cqXpvD zoom-in"
>
<i
class="sc-chbbiW fdVihP sl-zoom-in"
Expand Down

0 comments on commit 885d99a

Please sign in to comment.