Skip to content

Commit 0a794e7

Browse files
more sliders (#390)
1 parent 5be9c12 commit 0a794e7

File tree

6 files changed

+34
-9
lines changed

6 files changed

+34
-9
lines changed

src/components/widgets/EditableText.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ class EditableText extends Component {
5757
autoFocus,
5858
onKeyDown,
5959
placeholder,
60+
onWheel,
6061
readOnly,
6162
size,
6263
} = this.props;
@@ -73,6 +74,7 @@ class EditableText extends Component {
7374
autoFocus={autoFocus}
7475
onKeyPress={this.handleKeyPress}
7576
onKeyDown={onKeyDown}
77+
onWheel={onWheel}
7678
placeholder={placeholder}
7779
readOnly={readOnly}
7880
size={size}
@@ -91,6 +93,7 @@ EditableText.propTypes = {
9193
// Called on input keyDown events
9294
onKeyDown: PropTypes.func,
9395

96+
onWheel: PropTypes.func,
9497
// Input value property ...
9598
text: PropTypes.any,
9699

src/components/widgets/NumericInput.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export default class NumericInput extends Component {
1616
this.onChange = this.onChange.bind(this);
1717
this.updateValue = this.updateValue.bind(this);
1818
this.onKeyDown = this.onKeyDown.bind(this);
19+
this.onWheel = this.onWheel.bind(this);
1920
}
2021

2122
componentWillReceiveProps(nextProps) {
@@ -37,6 +38,15 @@ export default class NumericInput extends Component {
3738
}
3839
}
3940

41+
onWheel(e) {
42+
if (e.deltaY > 0) {
43+
this.incrementValue('increase');
44+
} else {
45+
this.incrementValue('decrease');
46+
}
47+
e.stopPropagation();
48+
}
49+
4050
onChange(value) {
4151
this.setState({value});
4252
}
@@ -145,6 +155,7 @@ export default class NumericInput extends Component {
145155
onChange={this.onChange}
146156
onUpdate={this.updateValue}
147157
onKeyDown={this.onKeyDown}
158+
onWheel={this.onWheel}
148159
/>
149160
{this.renderArrows()}
150161
{this.renderSlider()}

src/default_panels/StyleColorbarsPanel.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,12 @@ const StyleColorBarsPanel = ({localize: _}) => (
7070
/>
7171
</Section>
7272
<Section name={_('Horizontal Positioning')} attr="colorbar.x">
73-
<Numeric label={_('Horizontal Position')} attr="colorbar.x" />
73+
<Numeric
74+
label={_('Horizontal Position')}
75+
attr="colorbar.x"
76+
showSlider
77+
step={0.02}
78+
/>
7479

7580
<Dropdown
7681
label={_('Positioning Anchor')}
@@ -83,7 +88,12 @@ const StyleColorBarsPanel = ({localize: _}) => (
8388
/>
8489
</Section>
8590
<Section name={_('Vertical Positioning')} attr="colorbar.y">
86-
<Numeric label={_('Vertical Position')} attr="colorbar.y" />
91+
<Numeric
92+
label={_('Vertical Position')}
93+
attr="colorbar.y"
94+
showSlider
95+
step={0.02}
96+
/>
8797

8898
<Dropdown
8999
label={_('Positioning Anchor')}

src/default_panels/StyleLegendPanel.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,15 @@ const StyleLegendPanel = ({localize: _}) => (
6969
</MenuPanel>
7070
<Numeric
7171
label={_('X Position')}
72-
step={0.01}
72+
showSlider
73+
step={0.02}
7374
attr="legend.x"
74-
units="px"
7575
/>
7676
<Numeric
7777
label={_('Y Position')}
78-
step={0.01}
78+
showSlider
79+
step={0.02}
7980
attr="legend.y"
80-
units="px"
8181
/>
8282
</Section>
8383
<Section name={_('Orientation')}>

src/default_panels/StyleShapesPanel.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
PositioningRef,
88
PositioningNumeric,
99
Numeric,
10+
NumericFraction,
1011
ColorPicker,
1112
LineDashSelector,
1213
} from '../components';
@@ -49,7 +50,7 @@ const StyleShapesPanel = ({localize: _}) => (
4950
</Section>
5051
<Section name={_('Fill')}>
5152
<ColorPicker label={_('Color')} attr="fillcolor" />
52-
<Numeric label={_('Opacity')} step={0.1} attr="opacity" />
53+
<NumericFraction label={_('Opacity')} attr="opacity" />
5354
</Section>
5455
</ShapeAccordion>
5556
);

src/default_panels/StyleTracesPanel.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ const StyleTracesPanel = ({localize: _}) => (
4040
]}
4141
/>
4242

43-
<Numeric label={_('Opacity')} step={0.1} attr="opacity" />
43+
<NumericFraction label={_('Opacity')} attr="opacity" />
4444
<ColorPicker label={_('Color')} attr="color" />
4545

4646
<Section name={_('Text Attributes')}>
@@ -135,7 +135,7 @@ const StyleTracesPanel = ({localize: _}) => (
135135
/>
136136
<ColorscalePicker label={_('Colorscale')} attr="marker.colorscale" />
137137
<ColorPicker label={_('Color')} attr="marker.color" />
138-
<Numeric label={_('Opacity')} step={0.1} attr="marker.opacity" />
138+
<NumericFraction label={_('Opacity')} attr="marker.opacity" />
139139
<Numeric label={_('Size')} attr="marker.size" />
140140
<SymbolSelector label={_('Symbol')} attr="marker.symbol" />
141141
<Numeric label={_('Border Width')} attr="marker.line.width" />

0 commit comments

Comments
 (0)