Explorar el Código

another Slider2 fix

David Sehnal hace 4 años
padre
commit
91a46ea7df
Se han modificado 1 ficheros con 4 adiciones y 2 borrados
  1. 4 2
      src/mol-plugin-ui/controls/slider.tsx

+ 4 - 2
src/mol-plugin-ui/controls/slider.tsx

@@ -132,7 +132,7 @@ export class Slider2 extends React.Component<{
             </div>
             <div>
                 <SliderBase min={this.props.min} max={this.props.max} step={step} value={this.state.current} disabled={this.props.disabled}
-                    onBeforeChange={this.begin} onChange={this.updateCurrent as any} onAfterChange={this.end as any} range={true} pushable={true} />
+                    onBeforeChange={this.begin} onChange={this.updateCurrent as any} onAfterChange={this.end as any} range={true} allowCross />
             </div>
             <div>
                 <TextInput numeric delayMs={50}
@@ -391,14 +391,16 @@ export class SliderBase extends React.Component<SliderBaseProps, SliderBaseState
 
         const nextBounds = [...state.bounds];
         nextBounds[state.handle!] = value;
+
         let nextHandle = state.handle!;
-        if (props.pushable !== false) {
+        if (!!props.pushable) {
             const originalValue = state.bounds[nextHandle];
             this.pushSurroundingHandles(nextBounds, nextHandle, originalValue);
         } else if (props.allowCross) {
             nextBounds.sort((a, b) => a - b);
             nextHandle = nextBounds.indexOf(value);
         }
+
         this.onChange({
             handle: nextHandle,
             bounds: nextBounds,