@@ -4,6 +4,7 @@ import { useSelector } from "react-redux";
44import { twMerge } from "tailwind-merge" ;
55import { ids , selectors } from "@/constants" ;
66import { useSkipFirstRender } from "@/hooks" ;
7+ import type { ISTKProps } from "@/types" ;
78import { d3Extended } from "@/utils" ;
89import { Tool } from "../toolbar/data" ;
910
@@ -49,7 +50,7 @@ export const panAndZoom = ({ k, x, y }) => {
4950const panHandleClasses =
5051 "absolute z-10 text-black/40 cursor-pointer hover:text-black/80 transition-all duration-medium" ;
5152
52- const Zoom = ( ) => {
53+ const Zoom = ( props : ISTKProps ) => {
5354 const selectedTool = useSelector ( ( state : any ) => state . toolbar . selectedTool ) ;
5455 const showControls = useSelector ( ( state : any ) => state . editor . showControls ) ;
5556
@@ -94,29 +95,79 @@ const Zoom = () => {
9495 }
9596 } , [ showControls ] ) ;
9697
98+ const zoomStyles = props . styles ?. zoomControls ;
99+ const panStyles = props . styles ?. panControls ;
100+
97101 return (
98- < div id = { ids . zoomControls } className = "fixed bottom-14 left-20 flex flex-col items-center gap-4" >
99- < div className = "relative h-20 w-20 bg-white rounded-full border border-black/20 splash after:bg-black/5" >
102+ < div
103+ id = { ids . zoomControls }
104+ className = { twMerge ( "fixed bottom-14 left-20 flex flex-col items-center gap-4" , zoomStyles ?. root ?. className ) }
105+ style = { zoomStyles ?. root ?. properties }
106+ >
107+ < div
108+ className = { twMerge (
109+ "relative h-20 w-20 bg-white rounded-full border border-black/20 splash after:bg-black/5" ,
110+ panStyles ?. wheel ?. outerRing ?. className
111+ ) }
112+ style = { panStyles ?. wheel ?. outerRing ?. properties }
113+ >
100114 < div className = "absolute top-0 left-0 h-full w-full p-[1.125rem] z-20 pointer-events-none" >
101- < div className = "h-full w-full rounded-full bg-white border-2 border-black/50" />
115+ < div
116+ className = { twMerge (
117+ "h-full w-full rounded-full bg-white border-2 border-black/50" ,
118+ panStyles ?. wheel ?. innerRing ?. className
119+ ) }
120+ style = { panStyles ?. wheel ?. innerRing ?. properties }
121+ />
102122 </ div >
103- < ChevronLeft size = { 17 } className = { twMerge ( panHandleClasses , "left-0 top-[40%]" ) } onClick = { panLeft } />
104- < ChevronRight size = { 17 } className = { twMerge ( panHandleClasses , "right-0 top-[40%]" ) } onClick = { panRight } />
105- < ChevronUp size = { 17 } className = { twMerge ( panHandleClasses , "top-0 left-[40%]" ) } onClick = { panUp } />
106- < ChevronDown size = { 17 } className = { twMerge ( panHandleClasses , "bottom-0 left-[40%]" ) } onClick = { panDown } />
123+ < ChevronLeft
124+ size = { 17 }
125+ className = { twMerge ( panHandleClasses , "left-0 top-[40%]" , panStyles ?. handles ?. left ?. className ) }
126+ onClick = { panLeft }
127+ style = { panStyles ?. handles ?. left ?. properties }
128+ />
129+ < ChevronRight
130+ size = { 17 }
131+ className = { twMerge ( panHandleClasses , "right-0 top-[40%]" , panStyles ?. handles ?. right ?. className ) }
132+ onClick = { panRight }
133+ style = { panStyles ?. handles ?. right ?. properties }
134+ />
135+ < ChevronUp
136+ size = { 17 }
137+ className = { twMerge ( panHandleClasses , "top-0 left-[40%]" , panStyles ?. handles ?. up ?. className ) }
138+ onClick = { panUp }
139+ style = { panStyles ?. handles ?. up ?. properties }
140+ />
141+ < ChevronDown
142+ size = { 17 }
143+ className = { twMerge ( panHandleClasses , "bottom-0 left-[40%]" , panStyles ?. handles ?. down ?. className ) }
144+ onClick = { panDown }
145+ style = { panStyles ?. handles ?. down ?. properties }
146+ />
107147 </ div >
108- < div className = "bg-gray-100 p-2.5 rounded-md flex gap-1 items-center" >
148+ < div
149+ className = { twMerge ( "bg-gray-100 p-2.5 rounded-md flex gap-1 items-center" , zoomStyles ?. buttons ?. className ) }
150+ style = { zoomStyles ?. buttons ?. properties }
151+ >
109152 < div
110- className = "w-full sm:w-auto px-3 py-1.5 bg-white font-medium text-black/40 rounded-l cursor-pointer splash after:bg-black/5"
153+ className = { twMerge (
154+ "w-full sm:w-auto px-3 py-1.5 bg-white font-medium text-black/40 rounded-l cursor-pointer splash after:bg-black/5" ,
155+ zoomStyles ?. out ?. className
156+ ) }
111157 onClick = { zoomOut }
112158 role = "button"
159+ style = { zoomStyles ?. out ?. properties }
113160 >
114161 < Minus size = { 17 } />
115162 </ div >
116163 < div
117- className = "pz-2 py-1.5 min-w-[40px] flex justify-center items-center bg-white font-semibold rounded-r cursor-pointer splash after:bg-black/5"
164+ className = { twMerge (
165+ "pz-2 py-1.5 min-w-[40px] flex justify-center items-center bg-white font-semibold rounded-r cursor-pointer splash after:bg-black/5" ,
166+ zoomStyles ?. in ?. className
167+ ) }
118168 onClick = { zoomIn }
119169 role = "button"
170+ style = { zoomStyles ?. in ?. properties }
120171 >
121172 < Plus size = { 17 } />
122173 </ div >
0 commit comments