@@ -951,6 +951,10 @@ const QuantumCircuit = ({ numQubits, setNumQubits }) => {
951951 if ( numQubits < 2 && [ "CNOT" , "CZ" , "SWAP" ] . includes ( gate ) ) {
952952 return null ;
953953 }
954+
955+ const isActive = activeTab === "Circuit" ;
956+ const defaultBackground = isActive ? "white" : "#eee" ;
957+
954958 return (
955959 < div
956960 key = { index }
@@ -963,21 +967,31 @@ const QuantumCircuit = ({ numQubits, setNumQubits }) => {
963967 justifyContent : "center" ,
964968 border : "2px solid black" ,
965969 borderRadius : "5px" ,
966- cursor : "grab" ,
967- background : "white" ,
970+ cursor : isActive ? "grab" : "not-allowed ",
971+ background : defaultBackground ,
968972 fontFamily : "Fira Code, monospace" ,
969973 transition : "background-color 0.2s ease" ,
970974 margin : "5px" ,
975+ opacity : isActive ? 1 : 0.5 ,
976+ pointerEvents : isActive ? "auto" : "none" , // prevent interaction when locked
977+ } }
978+ draggable = { isActive }
979+ onDragStart = { ( e ) => {
980+ if ( isActive ) {
981+ e . dataTransfer . setData ( "text/plain" , gate ) ;
982+ }
983+ } }
984+ onMouseEnter = { ( e ) => {
985+ if ( isActive ) handleTooltipEnter ( e , gate ) ;
971986 } }
972- draggable
973- onDragStart = { ( e ) => e . dataTransfer . setData ( "text/plain" , gate ) }
974- onMouseEnter = { ( e ) => handleTooltipEnter ( e , gate ) }
975987 onMouseMove = { ( e ) => {
976- e . currentTarget . style . background = "oklch(80.9% 0.105 251.813)" ;
988+ if ( isActive ) {
989+ e . currentTarget . style . background = "oklch(80.9% 0.105 251.813)" ;
990+ }
977991 } }
978992 onMouseLeave = { ( e ) => {
979- e . currentTarget . style . background = "white" ;
980- handleTooltipLeave ( e ) ;
993+ e . currentTarget . style . background = defaultBackground ;
994+ if ( isActive ) handleTooltipLeave ( e ) ;
981995 } }
982996 >
983997 { gate }
0 commit comments