mirror of
https://github.com/a-nyx/maputnik-with-pmtiles.git
synced 2024-12-28 16:11:15 +01:00
Check for property-function support on data styles
This commit is contained in:
parent
2ffb3e73e1
commit
1d29f67065
1 changed files with 26 additions and 20 deletions
|
@ -261,13 +261,11 @@ export default class ZoomSpecProperty extends React.Component {
|
|||
}
|
||||
|
||||
renderProperty() {
|
||||
let functionBtn = null
|
||||
if(this.props.fieldSpec['zoom-function']) {
|
||||
functionBtn = <MakeFunctionButtons
|
||||
onZoomClick={this.makeZoomFunction.bind(this)}
|
||||
onDataClick={this.makeDataFunction.bind(this)}
|
||||
/>
|
||||
}
|
||||
const functionBtn = <MakeFunctionButtons
|
||||
fieldSpec={this.props.fieldSpec}
|
||||
onZoomClick={this.makeZoomFunction.bind(this)}
|
||||
onDataClick={this.makeDataFunction.bind(this)}
|
||||
/>
|
||||
return <InputBlock
|
||||
doc={this.props.fieldSpec.doc}
|
||||
label={labelFromFieldName(this.props.fieldName)}
|
||||
|
@ -296,8 +294,9 @@ export default class ZoomSpecProperty extends React.Component {
|
|||
}
|
||||
|
||||
function MakeFunctionButtons(props) {
|
||||
return <div>
|
||||
<Button
|
||||
let makeZoomButton, makeDataButton
|
||||
if (props.fieldSpec['zoom-function']) {
|
||||
makeZoomButton = <Button
|
||||
className="maputnik-make-zoom-function"
|
||||
onClick={props.onZoomClick}
|
||||
>
|
||||
|
@ -307,17 +306,24 @@ function MakeFunctionButtons(props) {
|
|||
doc={"Turn property into a zoom function to enable a map feature to change with map's zoom level."}
|
||||
/>
|
||||
</Button>
|
||||
<Button
|
||||
className="maputnik-make-data-function"
|
||||
onClick={props.onDataClick}
|
||||
>
|
||||
<DocLabel
|
||||
label={<MdInsertChart />}
|
||||
cursorTargetStyle={{ cursor: 'pointer' }}
|
||||
doc={"Turn property into a data function to enable a map feature to change according to data properties and the map's zoom level."}
|
||||
/>
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
if (props.fieldSpec['property-function']) {
|
||||
makeDataButton = <Button
|
||||
className="maputnik-make-data-function"
|
||||
onClick={props.onDataClick}
|
||||
>
|
||||
<DocLabel
|
||||
label={<MdInsertChart />}
|
||||
cursorTargetStyle={{ cursor: 'pointer' }}
|
||||
doc={"Turn property into a data function to enable a map feature to change according to data properties and the map's zoom level."}
|
||||
/>
|
||||
</Button>
|
||||
}
|
||||
return <div>{makeZoomButton}{makeDataButton}</div>
|
||||
}
|
||||
else {
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
function DeleteStopButton(props) {
|
||||
|
|
Loading…
Reference in a new issue