mirror of
https://github.com/maputnik/editor.git
synced 2025-12-17 19:50:01 +00:00
Only limit AutoComplete to window bounds if element is fixed.
This commit is contained in:
@@ -12,17 +12,19 @@ class LayerSourceLayer extends React.Component {
|
|||||||
value: PropTypes.string,
|
value: PropTypes.string,
|
||||||
onChange: PropTypes.func,
|
onChange: PropTypes.func,
|
||||||
sourceLayerIds: PropTypes.array,
|
sourceLayerIds: PropTypes.array,
|
||||||
|
isFixed: PropTypes.bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
static defaultProps = {
|
static defaultProps = {
|
||||||
onChange: () => {},
|
onChange: () => {},
|
||||||
sourceLayerIds: [],
|
sourceLayerIds: [],
|
||||||
|
isFixed: false
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return <InputBlock label={"Source Layer"} doc={styleSpec.latest.layer['source-layer'].doc}>
|
return <InputBlock label={"Source Layer"} doc={styleSpec.latest.layer['source-layer'].doc}>
|
||||||
<AutocompleteInput
|
<AutocompleteInput
|
||||||
keepMenuWithinWindowBounds={true}
|
keepMenuWithinWindowBounds={!!this.props.isFixed}
|
||||||
value={this.props.value}
|
value={this.props.value}
|
||||||
onChange={this.props.onChange}
|
onChange={this.props.onChange}
|
||||||
options={this.props.sourceLayerIds.map(l => [l, l])}
|
options={this.props.sourceLayerIds.map(l => [l, l])}
|
||||||
|
|||||||
@@ -127,6 +127,7 @@ class AddModal extends React.Component {
|
|||||||
}
|
}
|
||||||
{this.state.type !== 'background' && this.state.type !== 'raster' &&
|
{this.state.type !== 'background' && this.state.type !== 'raster' &&
|
||||||
<LayerSourceLayerBlock
|
<LayerSourceLayerBlock
|
||||||
|
isFixed={true}
|
||||||
sourceLayerIds={layers}
|
sourceLayerIds={layers}
|
||||||
value={this.state['source-layer']}
|
value={this.state['source-layer']}
|
||||||
onChange={v => this.setState({ 'source-layer': v })}
|
onChange={v => this.setState({ 'source-layer': v })}
|
||||||
|
|||||||
Reference in New Issue
Block a user