Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class RNMBXShapeSource(context: Context, private val mManager: RNMBXShapeSourceM
private var mClusterMaxZoom: Long? = null
private var mClusterProperties: HashMap<String, Any>? = null
private var mMaxZoom: Long? = null
private var mMinZoom: Long? = null
private var mBuffer: Long? = null
private var mTolerance: Double? = null
private var mLineMetrics: Boolean? = null
Expand Down Expand Up @@ -158,6 +159,10 @@ class RNMBXShapeSource(context: Context, private val mManager: RNMBXShapeSourceM
mMaxZoom = maxZoom
}

fun setMinZoom(minZoom: Long) {
mMinZoom = minZoom
}

fun setBuffer(buffer: Long) {
mBuffer = buffer
}
Expand Down Expand Up @@ -190,6 +195,9 @@ class RNMBXShapeSource(context: Context, private val mManager: RNMBXShapeSourceM
if (mMaxZoom != null) {
builder.maxzoom(mMaxZoom!!)
}
if (mMinZoom != null) {
builder.minzoom(mMinZoom!!)
}
if (mBuffer != null) {
builder.buffer(mBuffer!!)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,11 @@ class RNMBXShapeSourceManager(private val mContext: ReactApplicationContext, val
source.setMaxZoom(maxZoom.asInt().toLong())
}

@ReactProp(name = "minZoomLevel")
override fun setMinZoomLevel(source: RNMBXShapeSource, minZoom: Dynamic) {
source.setMinZoom(minZoom.asInt().toLong())
}

@ReactProp(name = "buffer")
override fun setBuffer(source: RNMBXShapeSource, buffer: Dynamic) {
source.setBuffer(buffer.asInt().toLong())
Expand Down
10 changes: 10 additions & 0 deletions docs/ShapeSource.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,16 @@ The default value is 18.



### minZoomLevel

```tsx
number
```
Specifies the minimum zoom level at which to create vector tiles.
The default value is 0.



### buffer

```tsx
Expand Down
7 changes: 7 additions & 0 deletions docs/docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -7679,6 +7679,13 @@
"default": "none",
"description": "Specifies the maximum zoom level at which to create vector tiles.\nA greater value produces greater detail at high zoom levels.\nThe default value is 18."
},
{
"name": "minZoomLevel",
"required": false,
"type": "number",
"default": "none",
"description": "Specifies the minimum zoom level at which to create vector tiles.\nThe default value is 0."
},
{
"name": "buffer",
"required": false,
Expand Down
5 changes: 5 additions & 0 deletions ios/RNMBX/RNMBXShapeSource.swift
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ public class RNMBXShapeSource : RNMBXSource {
@objc public var clusterProperties : [String: [Any]]?;

@objc public var maxZoomLevel : NSNumber?
@objc public var minZoomLevel : NSNumber?
@objc public var buffer : NSNumber?
@objc public var tolerance : NSNumber?
@objc public var lineMetrics : Bool = false
Expand Down Expand Up @@ -136,6 +137,10 @@ public class RNMBXShapeSource : RNMBXSource {
result.maxzoom = maxZoomLevel.doubleValue
}

if let minZoomLevel = minZoomLevel {
result.minzoom = minZoomLevel.doubleValue
}

if let buffer = buffer {
result.buffer = buffer.doubleValue
}
Expand Down
1 change: 1 addition & 0 deletions ios/RNMBX/RNMBXShapeSourceComponentView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ - (void)updateProps:(const Props::Shared &)props oldProps:(const Props::Shared &
RNMBX_OPTIONAL_PROP_NSNumber(clusterMaxZoomLevel)
RNMBX_OPTIONAL_PROP_NSDictionary(clusterProperties)
RNMBX_OPTIONAL_PROP_NSNumber(maxZoomLevel)
RNMBX_OPTIONAL_PROP_NSNumber(minZoomLevel)
RNMBX_OPTIONAL_PROP_NSNumber(buffer)
RNMBX_OPTIONAL_PROP_NSNumber(tolerance)
RNMBX_OPTIONAL_PROP_BOOL(lineMetrics)
Expand Down
7 changes: 7 additions & 0 deletions src/components/ShapeSource.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,12 @@ export type Props = {
*/
maxZoomLevel?: number;

/**
* Specifies the minimum zoom level at which to create vector tiles.
* The default value is 0.
*/
minZoomLevel?: number;

/**
* Specifies the size of the tile buffer on each side.
* A value of 0 produces no buffer. A value of 512 produces a buffer as wide as the tile itself.
Expand Down Expand Up @@ -312,6 +318,7 @@ export class ShapeSource extends NativeBridgeComponent(
clusterMaxZoomLevel: this.props.clusterMaxZoomLevel,
clusterProperties: this.props.clusterProperties,
maxZoomLevel: this.props.maxZoomLevel,
minZoomLevel: this.props.minZoomLevel,
buffer: this.props.buffer,
tolerance: this.props.tolerance,
lineMetrics: this.props.lineMetrics,
Expand Down
1 change: 1 addition & 0 deletions src/specs/RNMBXShapeSourceNativeComponent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export interface NativeProps extends ViewProps {
clusterMaxZoomLevel: UnsafeMixed<Double>;
clusterProperties: UnsafeMixed<any>;
maxZoomLevel: UnsafeMixed<Double>;
minZoomLevel: UnsafeMixed<Double>;
buffer: UnsafeMixed<Double>;
tolerance: UnsafeMixed<Double>;
lineMetrics: UnsafeMixed<boolean>;
Expand Down
Loading