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

Increase zoom limits and individual steps #1464

Merged
merged 3 commits into from
Jul 15, 2021
Merged
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
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