JonStargaryen 4 роки тому
батько
коміт
173c29424a
1 змінених файлів з 3 додано та 16 видалено
  1. 3 16
      src/viewer/ui/exchanges.tsx

+ 3 - 16
src/viewer/ui/exchanges.tsx

@@ -42,25 +42,12 @@ export class ExchangesControl extends React.PureComponent<{ handler: Residue }>
     onClickSwatch = (e: React.MouseEvent<HTMLButtonElement>) => {
         const tlc = e.currentTarget.getAttribute('data-id')!;
         this.props.handler.toggleExchange(tlc);
-        console.log(this.props.handler.exchanges);
-        // if (this.props.handler.hasExchange(tlc)) {
-        // this.setState(({ exchanges }) => {
-        //     const newExchanges = new Set(exchanges);
-        //     newExchanges.delete(tlc);
-        //
-        //     return {
-        //         exchanges: newExchanges
-        //     };
-        // });
-        // } else {
-        // this.setState(({ exchanges }) => ({
-        //     exchanges: new Set(exchanges).add(tlc)
-        // }));
-        // }
+        // TODO better use state?
+        this.forceUpdate();
     }
 
     swatch() {
-        // TODO update of isSelected style is delayed
+        // TODO update of isSelected style is delayed - this seems to be a browser-related bug
         return <div className='msp-combined-color-swatch'>
             {DefaultExchanges.map(e => {
                 const isSelected = this.props.handler.hasExchange(e[0]);