@@ -48,8 +48,7 @@ const repositionShape = (shape, dx, dy) => {
4848 if ( resizeCursors . includes ( shape . style ( "cursor" ) ) ) return ;
4949 const x = + shape . attr ( "x" ) + dx ;
5050 const y = + shape . attr ( "y" ) + dy ;
51- shape . attr ( "x" , x ) ;
52- shape . attr ( "y" , y ) ;
51+ shape . attr ( "x" , x ) . attr ( "y" , y ) ;
5352} ;
5453
5554const repositionPolyline = ( polyline , dx , dy ) => {
@@ -101,57 +100,47 @@ export const handlePolylineDrag = drag().on("drag", function (event) {
101100} ) ;
102101
103102export const showSeat = ( seat : d3 . Selection < Element , { } , HTMLElement , any > ) => {
104- seat . style ( "opacity" , "1" ) ;
105- seat . style ( "pointer-events" , "all" ) ;
106- const label = d3Extended . selectById ( `${ seat . attr ( "id" ) } -label` ) ;
107- label ?. style ( "opacity" , "1" ) ;
108- label ?. style ( "pointer-events" , "all" ) ;
103+ seat . style ( "display" , "block" ) ;
104+ d3Extended . selectById ( `${ seat . attr ( "id" ) } -label` ) ?. style ( "display" , "block" ) ;
109105} ;
110106
111107export const hideSeat = ( seat : d3 . Selection < Element , { } , HTMLElement , any > ) => {
112- seat . style ( "opacity" , "0" ) ;
113- seat . style ( "pointer-events" , "none" ) ;
114- const label = d3Extended . selectById ( `${ seat . attr ( "id" ) } -label` ) ;
115- label ?. style ( "opacity" , "0" ) ;
116- label ?. style ( "pointer-events" , "none" ) ;
108+ seat . style ( "display" , "none" ) ;
109+ d3Extended . selectById ( `${ seat . attr ( "id" ) } -label` ) ?. style ( "display" , "none" ) ;
117110} ;
118111
119112export const showPreOffsetElements = ( ) => {
120113 const seats = d3Extended . selectAll ( `[${ dataAttributes . elementType } ="${ ElementType . Seat } "]` ) ;
121- if ( seats . size ( ) && + seats ?. style ( "opacity " ) !== 0 ) {
114+ if ( seats . size ( ) && seats ?. style ( "display " ) !== "none" ) {
122115 const sections = d3Extended . selectAll (
123116 `[${ dataAttributes . elementType } ="${ ElementType . Polyline } "][${ dataAttributes . section } ]`
124117 ) ;
125118 const elementsEmbracingOffset = d3Extended . selectAll ( `[${ dataAttributes . embraceOffset } ="true"]` ) ;
126- seats . forEach ( hideSeat ) ;
119+ setTimeout ( ( ) => seats . forEach ( hideSeat ) , 100 ) ;
127120 sections . forEach ( ( section ) => {
128- section . style ( "opacity" , 1 ) ;
129- section . style ( "pointer-events" , "all" ) ;
121+ section . style ( "opacity" , 1 ) . style ( "pointer-events" , "all" ) ;
130122 } ) ;
131123 elementsEmbracingOffset . forEach ( ( element ) => {
132- element . style ( "opacity" , 1 ) ;
133- element . style ( "pointer-events" , "all" ) ;
124+ element . style ( "opacity" , 1 ) . style ( "pointer-events" , "all" ) ;
134125 } ) ;
135126 }
136127} ;
137128
138129export const showPostOffsetElements = ( ) => {
139130 const seats = d3Extended . selectAll ( `[${ dataAttributes . elementType } ="${ ElementType . Seat } "]` ) ;
140- if ( seats . size ( ) && + seats . style ( "opacity " ) !== 1 ) {
131+ if ( seats . size ( ) && seats . style ( "display " ) !== "block" ) {
141132 const sections = d3Extended . selectAll (
142133 `[${ dataAttributes . elementType } ="${ ElementType . Polyline } "][${ dataAttributes . section } ]`
143134 ) ;
144135 const elementsEmbracingOffset = d3Extended . selectAll ( `[${ dataAttributes . embraceOffset } ="true"]` ) ;
145136 seats . forEach ( showSeat ) ;
146137 sections . forEach ( ( section ) => {
147138 if ( section . attr ( dataAttributes . sectionFreeSeating ) !== "true" ) {
148- section . style ( "opacity" , 0 ) ;
149- section . style ( "pointer-events" , "none" ) ;
139+ section . style ( "opacity" , 0 ) . style ( "pointer-events" , "none" ) ;
150140 }
151141 } ) ;
152142 elementsEmbracingOffset . forEach ( ( element ) => {
153- element . style ( "opacity" , 0 ) ;
154- element . style ( "pointer-events" , "none" ) ;
143+ element . style ( "opacity" , 0 ) . style ( "pointer-events" , "none" ) ;
155144 } ) ;
156145 }
157146} ;
@@ -162,12 +151,10 @@ export const showAllElements = () => {
162151 const elementsEmbracingOffset = d3Extended . selectAll ( `[${ dataAttributes . embraceOffset } ="true"]` ) ;
163152 seats . forEach ( showSeat ) ;
164153 sections . forEach ( ( section ) => {
165- section . style ( "opacity" , 1 ) ;
166- section . style ( "pointer-events" , "all" ) ;
154+ section . style ( "opacity" , 1 ) . style ( "pointer-events" , "all" ) ;
167155 } ) ;
168156 elementsEmbracingOffset . forEach ( ( element ) => {
169- element . style ( "opacity" , 1 ) ;
170- element . style ( "pointer-events" , "all" ) ;
157+ element . style ( "opacity" , 1 ) . style ( "pointer-events" , "all" ) ;
171158 } ) ;
172159} ;
173160
0 commit comments