Skip to content

Commit 7896909

Browse files
Merge pull request #1246 from ivnnv/zoom-small-frame
Allow zoom buttons on small frames (with settings config)
2 parents 8ae77e8 + 0f4b1fb commit 7896909

File tree

4 files changed

+44
-26
lines changed

4 files changed

+44
-26
lines changed

src/browser/components/icons/Icons.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,17 +244,19 @@ export const ErrorIcon = () => (
244244
<IconContainer className="fa fa-file-text-o" text="Error" />
245245
)
246246

247-
export const ZoomInIcon = () => (
247+
export const ZoomInIcon = (props: any) => (
248248
<IconContainer
249249
activeStyle={inactive}
250250
inactiveStyle={inactive}
251+
{...props}
251252
className="sl-zoom-in"
252253
/>
253254
)
254-
export const ZoomOutIcon = () => (
255+
export const ZoomOutIcon = (props: any) => (
255256
<IconContainer
256257
activeStyle={inactive}
257258
inactiveStyle={inactive}
259+
{...props}
258260
className="sl-zoom-out"
259261
/>
260262
)

src/browser/modules/D3Visualization/components/Graph.tsx

Lines changed: 20 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -133,29 +133,26 @@ export class GraphComponent extends Component<any, State> {
133133
}
134134

135135
zoomButtons() {
136-
if (this.props.fullscreen) {
137-
return (
138-
<StyledZoomHolder>
139-
<StyledZoomButton
140-
className={
141-
this.state.zoomInLimitReached ? 'faded zoom-in' : 'zoom-in'
142-
}
143-
onClick={this.zoomInClicked.bind(this)}
144-
>
145-
<ZoomInIcon />
146-
</StyledZoomButton>
147-
<StyledZoomButton
148-
className={
149-
this.state.zoomOutLimitReached ? 'faded zoom-out' : 'zoom-out'
150-
}
151-
onClick={this.zoomOutClicked.bind(this)}
152-
>
153-
<ZoomOutIcon />
154-
</StyledZoomButton>
155-
</StyledZoomHolder>
156-
)
157-
}
158-
return null
136+
return (
137+
<StyledZoomHolder>
138+
<StyledZoomButton
139+
className={
140+
this.state.zoomInLimitReached ? 'faded zoom-in' : 'zoom-in'
141+
}
142+
onClick={this.zoomInClicked.bind(this)}
143+
>
144+
<ZoomInIcon regulateSize={this.props.fullscreen ? 2 : 1} />
145+
</StyledZoomButton>
146+
<StyledZoomButton
147+
className={
148+
this.state.zoomOutLimitReached ? 'faded zoom-out' : 'zoom-out'
149+
}
150+
onClick={this.zoomOutClicked.bind(this)}
151+
>
152+
<ZoomOutIcon regulateSize={this.props.fullscreen ? 2 : 1} />
153+
</StyledZoomButton>
154+
</StyledZoomHolder>
155+
)
159156
}
160157

161158
render() {

src/browser/modules/D3Visualization/components/styled.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,6 @@ export const StyledZoomHolder = styled.div`
362362
export const StyledZoomButton = styled.button`
363363
display: list-item;
364364
list-style-type: none;
365-
font-size: 2em;
366365
margin-bottom: 10px;
367366
border: none;
368367
color: #9b9da2;

src/browser/modules/Stream/CypherFrame/__snapshots__/VisualizationView.test.tsx.snap

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,26 @@ exports[`Visualization renders with result and escapes any HTML 1`] = `
130130
</g>
131131
</g>
132132
</svg>
133+
<div
134+
class="sc-eHgmQL fbpore"
135+
>
136+
<button
137+
class="sc-cvbbAY ZoyPP faded zoom-in"
138+
>
139+
<i
140+
class="sc-bYSBpT eYFbay sl-zoom-in"
141+
style="font-size: 1em;"
142+
/>
143+
</button>
144+
<button
145+
class="sc-cvbbAY ZoyPP zoom-out"
146+
>
147+
<i
148+
class="sc-elJkPf OBknV sl-zoom-out"
149+
style="font-size: 1em;"
150+
/>
151+
</button>
152+
</div>
133153
</div>
134154
<div
135155
class="sc-gqjmRU dwJWly status-bar"

0 commit comments

Comments
 (0)