Skip to content

Commit b281a80

Browse files
fix: zoom in/out click (#12056)
Co-authored-by: marvin <sea-son@foxmail.com>
1 parent c98d91e commit b281a80

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

web/app/components/workflow/operator/zoom-in-out.tsx

+10-4
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ const ZoomInOut: FC = () => {
129129
crossAxis: -2,
130130
}}
131131
>
132-
<PortalToFollowElemTrigger asChild onClick={handleTrigger}>
132+
<PortalToFollowElemTrigger asChild>
133133
<div className={`
134134
p-0.5 h-9 cursor-pointer text-[13px] backdrop-blur-[5px] rounded-lg
135135
bg-components-actionbar-bg shadow-lg border-[0.5px] border-components-actionbar-border
@@ -144,23 +144,29 @@ const ZoomInOut: FC = () => {
144144
shortcuts={['ctrl', '-']}
145145
>
146146
<div
147-
className='flex items-center justify-center w-8 h-8 rounded-lg cursor-pointer'
147+
className={`flex items-center justify-center w-8 h-8 rounded-lg ${zoom <= 0.25 ? 'cursor-not-allowed' : 'cursor-pointer hover:bg-black/5'}`}
148148
onClick={(e) => {
149+
if (zoom <= 0.25)
150+
return
151+
149152
e.stopPropagation()
150153
zoomOut()
151154
}}
152155
>
153156
<RiZoomOutLine className='w-4 h-4 text-text-tertiary hover:text-text-secondary' />
154157
</div>
155158
</TipPopup>
156-
<div className={cn('w-[34px] system-sm-medium text-text-tertiary hover:text-text-secondary')}>{parseFloat(`${zoom * 100}`).toFixed(0)}%</div>
159+
<div onClick={handleTrigger} className={cn('w-[34px] system-sm-medium text-text-tertiary hover:text-text-secondary')}>{parseFloat(`${zoom * 100}`).toFixed(0)}%</div>
157160
<TipPopup
158161
title={t('workflow.operator.zoomIn')}
159162
shortcuts={['ctrl', '+']}
160163
>
161164
<div
162-
className='flex items-center justify-center w-8 h-8 rounded-lg cursor-pointer'
165+
className={`flex items-center justify-center w-8 h-8 rounded-lg ${zoom >= 2 ? 'cursor-not-allowed' : 'cursor-pointer hover:bg-black/5'}`}
163166
onClick={(e) => {
167+
if (zoom >= 2)
168+
return
169+
164170
e.stopPropagation()
165171
zoomIn()
166172
}}

0 commit comments

Comments
 (0)