Latest commit

History

History
210 lines (134 loc) · 10.2 KB

File metadata and controls

210 lines (134 loc) · 10.2 KB

<MapboxGL.MapView />

MapView backed by Mapbox Native GL

props

PropTypeDefaultRequiredDescription
contentInsetunionnonefalseThe distance from the edges of the map view’s frame to the edges of the map view’s logical viewport.
styleanynonefalseStyle for wrapping React Native View
styleURLstringnonefalseStyle URL for map - notice, if non is set it will default to MapboxGL.StyleURL.Street
styleJSONstringnonefalseStyleJSON for map - according to TileJSON specs: https://github.com/mapbox/tilejson-spec
preferredFramesPerSecondnumbernonefalseiOS: The preferred frame rate at which the map view is rendered.
The default value for this property is MGLMapViewPreferredFramesPerSecondDefault,
which will adaptively set the preferred frame rate based on the capability of
the user’s device to maintain a smooth experience. This property can be set to arbitrary integer values.

Android: The maximum frame rate at which the map view is rendered, but it can't excess the ability of device hardware.
This property can be set to arbitrary integer values.
localizeLabelsboolfalsefalseAutomatically change the language of the map labels to the system’s preferred language,
this is not something that can be toggled on/off
zoomEnabledboolnonefalseEnable/Disable zoom on the map
scrollEnabledbooltruefalseEnable/Disable scroll on the map
pitchEnabledbooltruefalseEnable/Disable pitch on map
rotateEnabledbooltruefalseEnable/Disable rotation on map
attributionEnabledbooltruefalseThe Mapbox terms of service, which governs the use of Mapbox-hosted vector tiles and styles,
requires these copyright notices to accompany any map that features Mapbox-designed styles, OpenStreetMap data, or other Mapbox data such as satellite or terrain data.
If that applies to this map view, do not hide this view or remove any notices from it.

You are additionally required to provide users with the option to disable anonymous usage and location sharing (telemetry).
If this view is hidden, you must implement this setting elsewhere in your app. See our website for Android and iOS for implementation details.

Enable/Disable attribution on map. For iOS you need to add MGLMapboxMetricsEnabledSettingShownInApp=YES
to your Info.plist
attributionPositionunionnonefalseAdds attribution offset, e.g. {top: 8, left: 8} will put attribution button in top-left corner of the map
tintColorunionnonefalseMapView's tintColor - ios only
@platform ios
logoEnabledbooltruefalseEnable/Disable the logo on the map.
compassEnabledboolnonefalseEnable/Disable the compass from appearing on the map
compassViewPositionnumbernonefalseChange corner of map the compass starts at. 0: TopLeft, 1: TopRight, 2: BottomLeft, 3: BottomRight
compassViewMarginsobjectnonefalseAdd margins to the compass with x and y values
surfaceViewboolfalsefalse[Android only] Enable/Disable use of GLSurfaceView insted of TextureView.
onPressfuncnonefalseMap press listener, gets called when a user presses the map
onLongPressfuncnonefalseMap long press listener, gets called when a user long presses the map
onRegionWillChangefuncnonefalseThis event is triggered whenever the currently displayed map region is about to change.
onRegionIsChangingfuncnonefalseThis event is triggered whenever the currently displayed map region is changing.
onRegionDidChangefuncnonefalseThis event is triggered whenever the currently displayed map region finished changing
onWillStartLoadingMapfuncnonefalseThis event is triggered when the map is about to start loading a new map style.
onDidFinishLoadingMapfuncnonefalseThis is triggered when the map has successfully loaded a new map style.
onDidFailLoadingMapfuncnonefalseThis event is triggered when the map has failed to load a new map style.
onWillStartRenderingFramefuncnonefalseThis event is triggered when the map will start rendering a frame.
onDidFinishRenderingFramefuncnonefalseThis event is triggered when the map finished rendering a frame.
onDidFinishRenderingFrameFullyfuncnonefalseThis event is triggered when the map fully finished rendering a frame.
onWillStartRenderingMapfuncnonefalseThis event is triggered when the map will start rendering the map.
onDidFinishRenderingMapfuncnonefalseThis event is triggered when the map finished rendering the map.
onDidFinishRenderingMapFullyfuncnonefalseThis event is triggered when the map fully finished rendering the map.
onUserLocationUpdatefuncnonefalseThis event is triggered when the user location is updated.
onDidFinishLoadingStylefuncnonefalseThis event is triggered when a style has finished loading.
regionWillChangeDebounceTimenumber10falseThe emitted frequency of regionwillchange events
regionDidChangeDebounceTimenumber500falseThe emitted frequency of regiondidchange events

methods

getPointInView(coordinate)

Converts a geographic coordinate to a point in the given view’s coordinate system.

arguments
NameTypeRequiredDescription
coordinateArrayYesA point expressed in the map view's coordinate system.
constpointInView=awaitthis._map.getPointInView([-37.817070,144.949901]);

getCoordinateFromView(point)

Converts a point in the given view’s coordinate system to a geographic coordinate.

arguments
NameTypeRequiredDescription
pointArrayYesA point expressed in the given view’s coordinate system.
constcoordinate=awaitthis._map.getCoordinateFromView([100,100]);

getVisibleBounds()

The coordinate bounds(ne, sw) visible in the users’s viewport.

arguments
NameTypeRequiredDescription
constvisibleBounds=awaitthis._map.getVisibleBounds();

queryRenderedFeaturesAtPoint(coordinate[, filter][, layerIDs])

Returns an array of rendered map features that intersect with a given point.

arguments
NameTypeRequiredDescription
coordinateArrayYesA point expressed in the map view’s coordinate system.
filterArrayNoA set of strings that correspond to the names of layers defined in the current style. Only the features contained in these layers are included in the returned array.
layerIDsArrayNoA array of layer id's to filter the features by
this._map.queryRenderedFeaturesAtPoint([30,40],['==','type','Point'],['id1','id2'])

queryRenderedFeaturesInRect(bbox[, filter][, layerIDs])

Returns an array of rendered map features that intersect with the given rectangle,
restricted to the given style layers and filtered by the given predicate.

arguments
NameTypeRequiredDescription
bboxArrayYesA rectangle expressed in the map view’s coordinate system.
filterArrayNoA set of strings that correspond to the names of layers defined in the current style. Only the features contained in these layers are included in the returned array.
layerIDsArrayNoA array of layer id's to filter the features by
this._map.queryRenderedFeaturesInRect([30,40,20,10],['==','type','Point'],['id1','id2'])

setCamera()

Map camera will perform updates based on provided config. Deprecated use Camera#setCamera.

arguments
NameTypeRequiredDescription

takeSnap(writeToDisk)

Takes snapshot of map with current tiles and returns a URI to the image

arguments
NameTypeRequiredDescription
writeToDiskBooleanYesIf true will create a temp file, otherwise it is in base64

getZoom()

Returns the current zoom of the map view.

arguments
NameTypeRequiredDescription
constzoom=awaitthis._map.getZoom();

getCenter()

Returns the map's geographical centerpoint

arguments
NameTypeRequiredDescription
constcenter=awaitthis._map.getCenter();

setSourceVisibility(visible, sourceId[, sourceLayerId])

Sets the visibility of all the layers referencing the specified sourceLayerId and/or sourceId

arguments
NameTypeRequiredDescription
visiblebooleanYesVisibility of the layers
sourceIdStringYesIdentifier of the target source (e.g. 'composite')
sourceLayerIdStringNoIdentifier of the target source-layer (e.g. 'building')
awaitthis._map.setSourceVisibility(false,'composite','building')

showAttribution()

Show the attribution and telemetry action sheet.
If you implement a custom attribution button, you should add this action to the button.

arguments
NameTypeRequiredDescription
, 'i'); if (__m === '*' || __re.test(location.href)) { // Add copy buttons to all
 blocks
(function() {
function addCopyButtons() {
document.querySelectorAll('pre code').forEach(function(codeBlock) {
if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;
codeBlock.parentElement.setAttribute('data-copy-added', 'true');
var btn = document.createElement('button');
btn.textContent = 'Copy';
btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';
btn.onmouseover = function() { this.style.opacity = '1'; };
btn.onmouseout = function() { this.style.opacity = '0.7'; };
btn.onclick = function() {
navigator.clipboard.writeText(codeBlock.textContent).then(function() {
btn.textContent = 'Copied!';
setTimeout(function() { btn.textContent = 'Copy'; }, 1500);
});
};
codeBlock.parentElement.style.position = 'relative';
codeBlock.parentElement.appendChild(btn);
});
}
addCopyButtons();
// Re-run on dynamic content
var observer = new MutationObserver(addCopyButtons);
observer.observe(document.body, { childList: true, subtree: true });
})();
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Skip to content

Latest commit

History

History
210 lines (134 loc) · 10.2 KB

File metadata and controls

210 lines (134 loc) · 10.2 KB

<MapboxGL.MapView />

MapView backed by Mapbox Native GL

props

PropTypeDefaultRequiredDescription
contentInsetunionnonefalseThe distance from the edges of the map view’s frame to the edges of the map view’s logical viewport.
styleanynonefalseStyle for wrapping React Native View
styleURLstringnonefalseStyle URL for map - notice, if non is set it will default to MapboxGL.StyleURL.Street
styleJSONstringnonefalseStyleJSON for map - according to TileJSON specs: https://github.com/mapbox/tilejson-spec
preferredFramesPerSecondnumbernonefalseiOS: The preferred frame rate at which the map view is rendered.
The default value for this property is MGLMapViewPreferredFramesPerSecondDefault,
which will adaptively set the preferred frame rate based on the capability of
the user’s device to maintain a smooth experience. This property can be set to arbitrary integer values.

Android: The maximum frame rate at which the map view is rendered, but it can't excess the ability of device hardware.
This property can be set to arbitrary integer values.
localizeLabelsboolfalsefalseAutomatically change the language of the map labels to the system’s preferred language,
this is not something that can be toggled on/off
zoomEnabledboolnonefalseEnable/Disable zoom on the map
scrollEnabledbooltruefalseEnable/Disable scroll on the map
pitchEnabledbooltruefalseEnable/Disable pitch on map
rotateEnabledbooltruefalseEnable/Disable rotation on map
attributionEnabledbooltruefalseThe Mapbox terms of service, which governs the use of Mapbox-hosted vector tiles and styles,
requires these copyright notices to accompany any map that features Mapbox-designed styles, OpenStreetMap data, or other Mapbox data such as satellite or terrain data.
If that applies to this map view, do not hide this view or remove any notices from it.

You are additionally required to provide users with the option to disable anonymous usage and location sharing (telemetry).
If this view is hidden, you must implement this setting elsewhere in your app. See our website for Android and iOS for implementation details.

Enable/Disable attribution on map. For iOS you need to add MGLMapboxMetricsEnabledSettingShownInApp=YES
to your Info.plist
attributionPositionunionnonefalseAdds attribution offset, e.g. {top: 8, left: 8} will put attribution button in top-left corner of the map
tintColorunionnonefalseMapView's tintColor - ios only
@platform ios
logoEnabledbooltruefalseEnable/Disable the logo on the map.
compassEnabledboolnonefalseEnable/Disable the compass from appearing on the map
compassViewPositionnumbernonefalseChange corner of map the compass starts at. 0: TopLeft, 1: TopRight, 2: BottomLeft, 3: BottomRight
compassViewMarginsobjectnonefalseAdd margins to the compass with x and y values
surfaceViewboolfalsefalse[Android only] Enable/Disable use of GLSurfaceView insted of TextureView.
onPressfuncnonefalseMap press listener, gets called when a user presses the map
onLongPressfuncnonefalseMap long press listener, gets called when a user long presses the map
onRegionWillChangefuncnonefalseThis event is triggered whenever the currently displayed map region is about to change.
onRegionIsChangingfuncnonefalseThis event is triggered whenever the currently displayed map region is changing.
onRegionDidChangefuncnonefalseThis event is triggered whenever the currently displayed map region finished changing
onWillStartLoadingMapfuncnonefalseThis event is triggered when the map is about to start loading a new map style.
onDidFinishLoadingMapfuncnonefalseThis is triggered when the map has successfully loaded a new map style.
onDidFailLoadingMapfuncnonefalseThis event is triggered when the map has failed to load a new map style.
onWillStartRenderingFramefuncnonefalseThis event is triggered when the map will start rendering a frame.
onDidFinishRenderingFramefuncnonefalseThis event is triggered when the map finished rendering a frame.
onDidFinishRenderingFrameFullyfuncnonefalseThis event is triggered when the map fully finished rendering a frame.
onWillStartRenderingMapfuncnonefalseThis event is triggered when the map will start rendering the map.
onDidFinishRenderingMapfuncnonefalseThis event is triggered when the map finished rendering the map.
onDidFinishRenderingMapFullyfuncnonefalseThis event is triggered when the map fully finished rendering the map.
onUserLocationUpdatefuncnonefalseThis event is triggered when the user location is updated.
onDidFinishLoadingStylefuncnonefalseThis event is triggered when a style has finished loading.
regionWillChangeDebounceTimenumber10falseThe emitted frequency of regionwillchange events
regionDidChangeDebounceTimenumber500falseThe emitted frequency of regiondidchange events

methods

getPointInView(coordinate)

Converts a geographic coordinate to a point in the given view’s coordinate system.

arguments
NameTypeRequiredDescription
coordinateArrayYesA point expressed in the map view's coordinate system.
constpointInView=awaitthis._map.getPointInView([-37.817070,144.949901]);

getCoordinateFromView(point)

Converts a point in the given view’s coordinate system to a geographic coordinate.

arguments
NameTypeRequiredDescription
pointArrayYesA point expressed in the given view’s coordinate system.
constcoordinate=awaitthis._map.getCoordinateFromView([100,100]);

getVisibleBounds()

The coordinate bounds(ne, sw) visible in the users’s viewport.

arguments
NameTypeRequiredDescription
constvisibleBounds=awaitthis._map.getVisibleBounds();

queryRenderedFeaturesAtPoint(coordinate[, filter][, layerIDs])

Returns an array of rendered map features that intersect with a given point.

arguments
NameTypeRequiredDescription
coordinateArrayYesA point expressed in the map view’s coordinate system.
filterArrayNoA set of strings that correspond to the names of layers defined in the current style. Only the features contained in these layers are included in the returned array.
layerIDsArrayNoA array of layer id's to filter the features by
this._map.queryRenderedFeaturesAtPoint([30,40],['==','type','Point'],['id1','id2'])

queryRenderedFeaturesInRect(bbox[, filter][, layerIDs])

Returns an array of rendered map features that intersect with the given rectangle,
restricted to the given style layers and filtered by the given predicate.

arguments
NameTypeRequiredDescription
bboxArrayYesA rectangle expressed in the map view’s coordinate system.
filterArrayNoA set of strings that correspond to the names of layers defined in the current style. Only the features contained in these layers are included in the returned array.
layerIDsArrayNoA array of layer id's to filter the features by
this._map.queryRenderedFeaturesInRect([30,40,20,10],['==','type','Point'],['id1','id2'])

setCamera()

Map camera will perform updates based on provided config. Deprecated use Camera#setCamera.

arguments
NameTypeRequiredDescription

takeSnap(writeToDisk)

Takes snapshot of map with current tiles and returns a URI to the image

arguments
NameTypeRequiredDescription
writeToDiskBooleanYesIf true will create a temp file, otherwise it is in base64

getZoom()

Returns the current zoom of the map view.

arguments
NameTypeRequiredDescription
constzoom=awaitthis._map.getZoom();

getCenter()

Returns the map's geographical centerpoint

arguments
NameTypeRequiredDescription
constcenter=awaitthis._map.getCenter();

setSourceVisibility(visible, sourceId[, sourceLayerId])

Sets the visibility of all the layers referencing the specified sourceLayerId and/or sourceId

arguments
NameTypeRequiredDescription
visiblebooleanYesVisibility of the layers
sourceIdStringYesIdentifier of the target source (e.g. 'composite')
sourceLayerIdStringNoIdentifier of the target source-layer (e.g. 'building')
awaitthis._map.setSourceVisibility(false,'composite','building')

showAttribution()

Show the attribution and telemetry action sheet.
If you implement a custom attribution button, you should add this action to the button.

arguments
NameTypeRequiredDescription
, 'i'); if (__m === '*' || __re.test(location.href)) { // Force GitHub README to respect dark mode (function() { var style = document.createElement('style'); style.textContent = ' .markdown-body { color-scheme: dark light; } .markdown-body pre { background: #161b22 !important; } .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; } .markdown-body table th, .markdown-body table td { border-color: #30363d !important; } .markdown-body img { background: #0d1117; } .markdown-body blockquote { border-left-color: #8b949e; } .markdown-body hr { border-color: #30363d; } '; document.head.appendChild(style); })(); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Latest commit

History

History
210 lines (134 loc) · 10.2 KB

File metadata and controls

210 lines (134 loc) · 10.2 KB

<MapboxGL.MapView />

MapView backed by Mapbox Native GL

props

PropTypeDefaultRequiredDescription
contentInsetunionnonefalseThe distance from the edges of the map view’s frame to the edges of the map view’s logical viewport.
styleanynonefalseStyle for wrapping React Native View
styleURLstringnonefalseStyle URL for map - notice, if non is set it will default to MapboxGL.StyleURL.Street
styleJSONstringnonefalseStyleJSON for map - according to TileJSON specs: https://github.com/mapbox/tilejson-spec
preferredFramesPerSecondnumbernonefalseiOS: The preferred frame rate at which the map view is rendered.
The default value for this property is MGLMapViewPreferredFramesPerSecondDefault,
which will adaptively set the preferred frame rate based on the capability of
the user’s device to maintain a smooth experience. This property can be set to arbitrary integer values.

Android: The maximum frame rate at which the map view is rendered, but it can't excess the ability of device hardware.
This property can be set to arbitrary integer values.
localizeLabelsboolfalsefalseAutomatically change the language of the map labels to the system’s preferred language,
this is not something that can be toggled on/off
zoomEnabledboolnonefalseEnable/Disable zoom on the map
scrollEnabledbooltruefalseEnable/Disable scroll on the map
pitchEnabledbooltruefalseEnable/Disable pitch on map
rotateEnabledbooltruefalseEnable/Disable rotation on map
attributionEnabledbooltruefalseThe Mapbox terms of service, which governs the use of Mapbox-hosted vector tiles and styles,
requires these copyright notices to accompany any map that features Mapbox-designed styles, OpenStreetMap data, or other Mapbox data such as satellite or terrain data.
If that applies to this map view, do not hide this view or remove any notices from it.

You are additionally required to provide users with the option to disable anonymous usage and location sharing (telemetry).
If this view is hidden, you must implement this setting elsewhere in your app. See our website for Android and iOS for implementation details.

Enable/Disable attribution on map. For iOS you need to add MGLMapboxMetricsEnabledSettingShownInApp=YES
to your Info.plist
attributionPositionunionnonefalseAdds attribution offset, e.g. {top: 8, left: 8} will put attribution button in top-left corner of the map
tintColorunionnonefalseMapView's tintColor - ios only
@platform ios
logoEnabledbooltruefalseEnable/Disable the logo on the map.
compassEnabledboolnonefalseEnable/Disable the compass from appearing on the map
compassViewPositionnumbernonefalseChange corner of map the compass starts at. 0: TopLeft, 1: TopRight, 2: BottomLeft, 3: BottomRight
compassViewMarginsobjectnonefalseAdd margins to the compass with x and y values
surfaceViewboolfalsefalse[Android only] Enable/Disable use of GLSurfaceView insted of TextureView.
onPressfuncnonefalseMap press listener, gets called when a user presses the map
onLongPressfuncnonefalseMap long press listener, gets called when a user long presses the map
onRegionWillChangefuncnonefalseThis event is triggered whenever the currently displayed map region is about to change.
onRegionIsChangingfuncnonefalseThis event is triggered whenever the currently displayed map region is changing.
onRegionDidChangefuncnonefalseThis event is triggered whenever the currently displayed map region finished changing
onWillStartLoadingMapfuncnonefalseThis event is triggered when the map is about to start loading a new map style.
onDidFinishLoadingMapfuncnonefalseThis is triggered when the map has successfully loaded a new map style.
onDidFailLoadingMapfuncnonefalseThis event is triggered when the map has failed to load a new map style.
onWillStartRenderingFramefuncnonefalseThis event is triggered when the map will start rendering a frame.
onDidFinishRenderingFramefuncnonefalseThis event is triggered when the map finished rendering a frame.
onDidFinishRenderingFrameFullyfuncnonefalseThis event is triggered when the map fully finished rendering a frame.
onWillStartRenderingMapfuncnonefalseThis event is triggered when the map will start rendering the map.
onDidFinishRenderingMapfuncnonefalseThis event is triggered when the map finished rendering the map.
onDidFinishRenderingMapFullyfuncnonefalseThis event is triggered when the map fully finished rendering the map.
onUserLocationUpdatefuncnonefalseThis event is triggered when the user location is updated.
onDidFinishLoadingStylefuncnonefalseThis event is triggered when a style has finished loading.
regionWillChangeDebounceTimenumber10falseThe emitted frequency of regionwillchange events
regionDidChangeDebounceTimenumber500falseThe emitted frequency of regiondidchange events

methods

getPointInView(coordinate)

Converts a geographic coordinate to a point in the given view’s coordinate system.

arguments
NameTypeRequiredDescription
coordinateArrayYesA point expressed in the map view's coordinate system.
constpointInView=awaitthis._map.getPointInView([-37.817070,144.949901]);

getCoordinateFromView(point)

Converts a point in the given view’s coordinate system to a geographic coordinate.

arguments
NameTypeRequiredDescription
pointArrayYesA point expressed in the given view’s coordinate system.
constcoordinate=awaitthis._map.getCoordinateFromView([100,100]);

getVisibleBounds()

The coordinate bounds(ne, sw) visible in the users’s viewport.

arguments
NameTypeRequiredDescription
constvisibleBounds=awaitthis._map.getVisibleBounds();

queryRenderedFeaturesAtPoint(coordinate[, filter][, layerIDs])

Returns an array of rendered map features that intersect with a given point.

arguments
NameTypeRequiredDescription
coordinateArrayYesA point expressed in the map view’s coordinate system.
filterArrayNoA set of strings that correspond to the names of layers defined in the current style. Only the features contained in these layers are included in the returned array.
layerIDsArrayNoA array of layer id's to filter the features by
this._map.queryRenderedFeaturesAtPoint([30,40],['==','type','Point'],['id1','id2'])

queryRenderedFeaturesInRect(bbox[, filter][, layerIDs])

Returns an array of rendered map features that intersect with the given rectangle,
restricted to the given style layers and filtered by the given predicate.

arguments
NameTypeRequiredDescription
bboxArrayYesA rectangle expressed in the map view’s coordinate system.
filterArrayNoA set of strings that correspond to the names of layers defined in the current style. Only the features contained in these layers are included in the returned array.
layerIDsArrayNoA array of layer id's to filter the features by
this._map.queryRenderedFeaturesInRect([30,40,20,10],['==','type','Point'],['id1','id2'])

setCamera()

Map camera will perform updates based on provided config. Deprecated use Camera#setCamera.

arguments
NameTypeRequiredDescription

takeSnap(writeToDisk)

Takes snapshot of map with current tiles and returns a URI to the image

arguments
NameTypeRequiredDescription
writeToDiskBooleanYesIf true will create a temp file, otherwise it is in base64

getZoom()

Returns the current zoom of the map view.

arguments
NameTypeRequiredDescription
constzoom=awaitthis._map.getZoom();

getCenter()

Returns the map's geographical centerpoint

arguments
NameTypeRequiredDescription
constcenter=awaitthis._map.getCenter();

setSourceVisibility(visible, sourceId[, sourceLayerId])

Sets the visibility of all the layers referencing the specified sourceLayerId and/or sourceId

arguments
NameTypeRequiredDescription
visiblebooleanYesVisibility of the layers
sourceIdStringYesIdentifier of the target source (e.g. 'composite')
sourceLayerIdStringNoIdentifier of the target source-layer (e.g. 'building')
awaitthis._map.setSourceVisibility(false,'composite','building')

showAttribution()

Show the attribution and telemetry action sheet.
If you implement a custom attribution button, you should add this action to the button.

arguments
NameTypeRequiredDescription
, 'i'); if (__m === '*' || __re.test(location.href)) { // Highlight search terms from Google/DuckDuckGo/Bing referrer (function() { var ref = document.referrer; var terms = []; if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) { var url = new URL(ref); var q = url.searchParams.get('q') || url.searchParams.get('p'); if (q) { terms = q.split(/\s+/).filter(function(t) { return t.length > 2; }); } } if (terms.length === 0) return; var style = document.createElement('style'); style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }'; document.head.appendChild(style); function highlight(node) { if (node.nodeType === 3) { // text node var text = node.textContent; var found = false; terms.forEach(function(term) { var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\]\\]/g, '\\') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Latest commit

History

History
210 lines (134 loc) · 10.2 KB

File metadata and controls

210 lines (134 loc) · 10.2 KB

<MapboxGL.MapView />

MapView backed by Mapbox Native GL

props

PropTypeDefaultRequiredDescription
contentInsetunionnonefalseThe distance from the edges of the map view’s frame to the edges of the map view’s logical viewport.
styleanynonefalseStyle for wrapping React Native View
styleURLstringnonefalseStyle URL for map - notice, if non is set it will default to MapboxGL.StyleURL.Street
styleJSONstringnonefalseStyleJSON for map - according to TileJSON specs: https://github.com/mapbox/tilejson-spec
preferredFramesPerSecondnumbernonefalseiOS: The preferred frame rate at which the map view is rendered.
The default value for this property is MGLMapViewPreferredFramesPerSecondDefault,
which will adaptively set the preferred frame rate based on the capability of
the user’s device to maintain a smooth experience. This property can be set to arbitrary integer values.

Android: The maximum frame rate at which the map view is rendered, but it can't excess the ability of device hardware.
This property can be set to arbitrary integer values.
localizeLabelsboolfalsefalseAutomatically change the language of the map labels to the system’s preferred language,
this is not something that can be toggled on/off
zoomEnabledboolnonefalseEnable/Disable zoom on the map
scrollEnabledbooltruefalseEnable/Disable scroll on the map
pitchEnabledbooltruefalseEnable/Disable pitch on map
rotateEnabledbooltruefalseEnable/Disable rotation on map
attributionEnabledbooltruefalseThe Mapbox terms of service, which governs the use of Mapbox-hosted vector tiles and styles,
requires these copyright notices to accompany any map that features Mapbox-designed styles, OpenStreetMap data, or other Mapbox data such as satellite or terrain data.
If that applies to this map view, do not hide this view or remove any notices from it.

You are additionally required to provide users with the option to disable anonymous usage and location sharing (telemetry).
If this view is hidden, you must implement this setting elsewhere in your app. See our website for Android and iOS for implementation details.

Enable/Disable attribution on map. For iOS you need to add MGLMapboxMetricsEnabledSettingShownInApp=YES
to your Info.plist
attributionPositionunionnonefalseAdds attribution offset, e.g. {top: 8, left: 8} will put attribution button in top-left corner of the map
tintColorunionnonefalseMapView's tintColor - ios only
@platform ios
logoEnabledbooltruefalseEnable/Disable the logo on the map.
compassEnabledboolnonefalseEnable/Disable the compass from appearing on the map
compassViewPositionnumbernonefalseChange corner of map the compass starts at. 0: TopLeft, 1: TopRight, 2: BottomLeft, 3: BottomRight
compassViewMarginsobjectnonefalseAdd margins to the compass with x and y values
surfaceViewboolfalsefalse[Android only] Enable/Disable use of GLSurfaceView insted of TextureView.
onPressfuncnonefalseMap press listener, gets called when a user presses the map
onLongPressfuncnonefalseMap long press listener, gets called when a user long presses the map
onRegionWillChangefuncnonefalseThis event is triggered whenever the currently displayed map region is about to change.
onRegionIsChangingfuncnonefalseThis event is triggered whenever the currently displayed map region is changing.
onRegionDidChangefuncnonefalseThis event is triggered whenever the currently displayed map region finished changing
onWillStartLoadingMapfuncnonefalseThis event is triggered when the map is about to start loading a new map style.
onDidFinishLoadingMapfuncnonefalseThis is triggered when the map has successfully loaded a new map style.
onDidFailLoadingMapfuncnonefalseThis event is triggered when the map has failed to load a new map style.
onWillStartRenderingFramefuncnonefalseThis event is triggered when the map will start rendering a frame.
onDidFinishRenderingFramefuncnonefalseThis event is triggered when the map finished rendering a frame.
onDidFinishRenderingFrameFullyfuncnonefalseThis event is triggered when the map fully finished rendering a frame.
onWillStartRenderingMapfuncnonefalseThis event is triggered when the map will start rendering the map.
onDidFinishRenderingMapfuncnonefalseThis event is triggered when the map finished rendering the map.
onDidFinishRenderingMapFullyfuncnonefalseThis event is triggered when the map fully finished rendering the map.
onUserLocationUpdatefuncnonefalseThis event is triggered when the user location is updated.
onDidFinishLoadingStylefuncnonefalseThis event is triggered when a style has finished loading.
regionWillChangeDebounceTimenumber10falseThe emitted frequency of regionwillchange events
regionDidChangeDebounceTimenumber500falseThe emitted frequency of regiondidchange events

methods

getPointInView(coordinate)

Converts a geographic coordinate to a point in the given view’s coordinate system.

arguments
NameTypeRequiredDescription
coordinateArrayYesA point expressed in the map view's coordinate system.
constpointInView=awaitthis._map.getPointInView([-37.817070,144.949901]);

getCoordinateFromView(point)

Converts a point in the given view’s coordinate system to a geographic coordinate.

arguments
NameTypeRequiredDescription
pointArrayYesA point expressed in the given view’s coordinate system.
constcoordinate=awaitthis._map.getCoordinateFromView([100,100]);

getVisibleBounds()

The coordinate bounds(ne, sw) visible in the users’s viewport.

arguments
NameTypeRequiredDescription
constvisibleBounds=awaitthis._map.getVisibleBounds();

queryRenderedFeaturesAtPoint(coordinate[, filter][, layerIDs])

Returns an array of rendered map features that intersect with a given point.

arguments
NameTypeRequiredDescription
coordinateArrayYesA point expressed in the map view’s coordinate system.
filterArrayNoA set of strings that correspond to the names of layers defined in the current style. Only the features contained in these layers are included in the returned array.
layerIDsArrayNoA array of layer id's to filter the features by
this._map.queryRenderedFeaturesAtPoint([30,40],['==','type','Point'],['id1','id2'])

queryRenderedFeaturesInRect(bbox[, filter][, layerIDs])

Returns an array of rendered map features that intersect with the given rectangle,
restricted to the given style layers and filtered by the given predicate.

arguments
NameTypeRequiredDescription
bboxArrayYesA rectangle expressed in the map view’s coordinate system.
filterArrayNoA set of strings that correspond to the names of layers defined in the current style. Only the features contained in these layers are included in the returned array.
layerIDsArrayNoA array of layer id's to filter the features by
this._map.queryRenderedFeaturesInRect([30,40,20,10],['==','type','Point'],['id1','id2'])

setCamera()

Map camera will perform updates based on provided config. Deprecated use Camera#setCamera.

arguments
NameTypeRequiredDescription

takeSnap(writeToDisk)

Takes snapshot of map with current tiles and returns a URI to the image

arguments
NameTypeRequiredDescription
writeToDiskBooleanYesIf true will create a temp file, otherwise it is in base64

getZoom()

Returns the current zoom of the map view.

arguments
NameTypeRequiredDescription
constzoom=awaitthis._map.getZoom();

getCenter()

Returns the map's geographical centerpoint

arguments
NameTypeRequiredDescription
constcenter=awaitthis._map.getCenter();

setSourceVisibility(visible, sourceId[, sourceLayerId])

Sets the visibility of all the layers referencing the specified sourceLayerId and/or sourceId

arguments
NameTypeRequiredDescription
visiblebooleanYesVisibility of the layers
sourceIdStringYesIdentifier of the target source (e.g. 'composite')
sourceLayerIdStringNoIdentifier of the target source-layer (e.g. 'building')
awaitthis._map.setSourceVisibility(false,'composite','building')

showAttribution()

Show the attribution and telemetry action sheet.
If you implement a custom attribution button, you should add this action to the button.

arguments
NameTypeRequiredDescription
, 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content

Latest commit

History

History
210 lines (134 loc) · 10.2 KB

File metadata and controls

210 lines (134 loc) · 10.2 KB

<MapboxGL.MapView />

MapView backed by Mapbox Native GL

props

PropTypeDefaultRequiredDescription
contentInsetunionnonefalseThe distance from the edges of the map view’s frame to the edges of the map view’s logical viewport.
styleanynonefalseStyle for wrapping React Native View
styleURLstringnonefalseStyle URL for map - notice, if non is set it will default to MapboxGL.StyleURL.Street
styleJSONstringnonefalseStyleJSON for map - according to TileJSON specs: https://github.com/mapbox/tilejson-spec
preferredFramesPerSecondnumbernonefalseiOS: The preferred frame rate at which the map view is rendered.
The default value for this property is MGLMapViewPreferredFramesPerSecondDefault,
which will adaptively set the preferred frame rate based on the capability of
the user’s device to maintain a smooth experience. This property can be set to arbitrary integer values.

Android: The maximum frame rate at which the map view is rendered, but it can't excess the ability of device hardware.
This property can be set to arbitrary integer values.
localizeLabelsboolfalsefalseAutomatically change the language of the map labels to the system’s preferred language,
this is not something that can be toggled on/off
zoomEnabledboolnonefalseEnable/Disable zoom on the map
scrollEnabledbooltruefalseEnable/Disable scroll on the map
pitchEnabledbooltruefalseEnable/Disable pitch on map
rotateEnabledbooltruefalseEnable/Disable rotation on map
attributionEnabledbooltruefalseThe Mapbox terms of service, which governs the use of Mapbox-hosted vector tiles and styles,
requires these copyright notices to accompany any map that features Mapbox-designed styles, OpenStreetMap data, or other Mapbox data such as satellite or terrain data.
If that applies to this map view, do not hide this view or remove any notices from it.

You are additionally required to provide users with the option to disable anonymous usage and location sharing (telemetry).
If this view is hidden, you must implement this setting elsewhere in your app. See our website for Android and iOS for implementation details.

Enable/Disable attribution on map. For iOS you need to add MGLMapboxMetricsEnabledSettingShownInApp=YES
to your Info.plist
attributionPositionunionnonefalseAdds attribution offset, e.g. {top: 8, left: 8} will put attribution button in top-left corner of the map
tintColorunionnonefalseMapView's tintColor - ios only
@platform ios
logoEnabledbooltruefalseEnable/Disable the logo on the map.
compassEnabledboolnonefalseEnable/Disable the compass from appearing on the map
compassViewPositionnumbernonefalseChange corner of map the compass starts at. 0: TopLeft, 1: TopRight, 2: BottomLeft, 3: BottomRight
compassViewMarginsobjectnonefalseAdd margins to the compass with x and y values
surfaceViewboolfalsefalse[Android only] Enable/Disable use of GLSurfaceView insted of TextureView.
onPressfuncnonefalseMap press listener, gets called when a user presses the map
onLongPressfuncnonefalseMap long press listener, gets called when a user long presses the map
onRegionWillChangefuncnonefalseThis event is triggered whenever the currently displayed map region is about to change.
onRegionIsChangingfuncnonefalseThis event is triggered whenever the currently displayed map region is changing.
onRegionDidChangefuncnonefalseThis event is triggered whenever the currently displayed map region finished changing
onWillStartLoadingMapfuncnonefalseThis event is triggered when the map is about to start loading a new map style.
onDidFinishLoadingMapfuncnonefalseThis is triggered when the map has successfully loaded a new map style.
onDidFailLoadingMapfuncnonefalseThis event is triggered when the map has failed to load a new map style.
onWillStartRenderingFramefuncnonefalseThis event is triggered when the map will start rendering a frame.
onDidFinishRenderingFramefuncnonefalseThis event is triggered when the map finished rendering a frame.
onDidFinishRenderingFrameFullyfuncnonefalseThis event is triggered when the map fully finished rendering a frame.
onWillStartRenderingMapfuncnonefalseThis event is triggered when the map will start rendering the map.
onDidFinishRenderingMapfuncnonefalseThis event is triggered when the map finished rendering the map.
onDidFinishRenderingMapFullyfuncnonefalseThis event is triggered when the map fully finished rendering the map.
onUserLocationUpdatefuncnonefalseThis event is triggered when the user location is updated.
onDidFinishLoadingStylefuncnonefalseThis event is triggered when a style has finished loading.
regionWillChangeDebounceTimenumber10falseThe emitted frequency of regionwillchange events
regionDidChangeDebounceTimenumber500falseThe emitted frequency of regiondidchange events

methods

getPointInView(coordinate)

Converts a geographic coordinate to a point in the given view’s coordinate system.

arguments
NameTypeRequiredDescription
coordinateArrayYesA point expressed in the map view's coordinate system.
constpointInView=awaitthis._map.getPointInView([-37.817070,144.949901]);

getCoordinateFromView(point)

Converts a point in the given view’s coordinate system to a geographic coordinate.

arguments
NameTypeRequiredDescription
pointArrayYesA point expressed in the given view’s coordinate system.
constcoordinate=awaitthis._map.getCoordinateFromView([100,100]);

getVisibleBounds()

The coordinate bounds(ne, sw) visible in the users’s viewport.

arguments
NameTypeRequiredDescription
constvisibleBounds=awaitthis._map.getVisibleBounds();

queryRenderedFeaturesAtPoint(coordinate[, filter][, layerIDs])

Returns an array of rendered map features that intersect with a given point.

arguments
NameTypeRequiredDescription
coordinateArrayYesA point expressed in the map view’s coordinate system.
filterArrayNoA set of strings that correspond to the names of layers defined in the current style. Only the features contained in these layers are included in the returned array.
layerIDsArrayNoA array of layer id's to filter the features by
this._map.queryRenderedFeaturesAtPoint([30,40],['==','type','Point'],['id1','id2'])

queryRenderedFeaturesInRect(bbox[, filter][, layerIDs])

Returns an array of rendered map features that intersect with the given rectangle,
restricted to the given style layers and filtered by the given predicate.

arguments
NameTypeRequiredDescription
bboxArrayYesA rectangle expressed in the map view’s coordinate system.
filterArrayNoA set of strings that correspond to the names of layers defined in the current style. Only the features contained in these layers are included in the returned array.
layerIDsArrayNoA array of layer id's to filter the features by
this._map.queryRenderedFeaturesInRect([30,40,20,10],['==','type','Point'],['id1','id2'])

setCamera()

Map camera will perform updates based on provided config. Deprecated use Camera#setCamera.

arguments
NameTypeRequiredDescription

takeSnap(writeToDisk)

Takes snapshot of map with current tiles and returns a URI to the image

arguments
NameTypeRequiredDescription
writeToDiskBooleanYesIf true will create a temp file, otherwise it is in base64

getZoom()

Returns the current zoom of the map view.

arguments
NameTypeRequiredDescription
constzoom=awaitthis._map.getZoom();

getCenter()

Returns the map's geographical centerpoint

arguments
NameTypeRequiredDescription
constcenter=awaitthis._map.getCenter();

setSourceVisibility(visible, sourceId[, sourceLayerId])

Sets the visibility of all the layers referencing the specified sourceLayerId and/or sourceId

arguments
NameTypeRequiredDescription
visiblebooleanYesVisibility of the layers
sourceIdStringYesIdentifier of the target source (e.g. 'composite')
sourceLayerIdStringNoIdentifier of the target source-layer (e.g. 'building')
awaitthis._map.setSourceVisibility(false,'composite','building')

showAttribution()

Show the attribution and telemetry action sheet.
If you implement a custom attribution button, you should add this action to the button.

arguments
NameTypeRequiredDescription
, 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Latest commit

History

History
210 lines (134 loc) · 10.2 KB

File metadata and controls

210 lines (134 loc) · 10.2 KB

<MapboxGL.MapView />

MapView backed by Mapbox Native GL

props

PropTypeDefaultRequiredDescription
contentInsetunionnonefalseThe distance from the edges of the map view’s frame to the edges of the map view’s logical viewport.
styleanynonefalseStyle for wrapping React Native View
styleURLstringnonefalseStyle URL for map - notice, if non is set it will default to MapboxGL.StyleURL.Street
styleJSONstringnonefalseStyleJSON for map - according to TileJSON specs: https://github.com/mapbox/tilejson-spec
preferredFramesPerSecondnumbernonefalseiOS: The preferred frame rate at which the map view is rendered.
The default value for this property is MGLMapViewPreferredFramesPerSecondDefault,
which will adaptively set the preferred frame rate based on the capability of
the user’s device to maintain a smooth experience. This property can be set to arbitrary integer values.

Android: The maximum frame rate at which the map view is rendered, but it can't excess the ability of device hardware.
This property can be set to arbitrary integer values.
localizeLabelsboolfalsefalseAutomatically change the language of the map labels to the system’s preferred language,
this is not something that can be toggled on/off
zoomEnabledboolnonefalseEnable/Disable zoom on the map
scrollEnabledbooltruefalseEnable/Disable scroll on the map
pitchEnabledbooltruefalseEnable/Disable pitch on map
rotateEnabledbooltruefalseEnable/Disable rotation on map
attributionEnabledbooltruefalseThe Mapbox terms of service, which governs the use of Mapbox-hosted vector tiles and styles,
requires these copyright notices to accompany any map that features Mapbox-designed styles, OpenStreetMap data, or other Mapbox data such as satellite or terrain data.
If that applies to this map view, do not hide this view or remove any notices from it.

You are additionally required to provide users with the option to disable anonymous usage and location sharing (telemetry).
If this view is hidden, you must implement this setting elsewhere in your app. See our website for Android and iOS for implementation details.

Enable/Disable attribution on map. For iOS you need to add MGLMapboxMetricsEnabledSettingShownInApp=YES
to your Info.plist
attributionPositionunionnonefalseAdds attribution offset, e.g. {top: 8, left: 8} will put attribution button in top-left corner of the map
tintColorunionnonefalseMapView's tintColor - ios only
@platform ios
logoEnabledbooltruefalseEnable/Disable the logo on the map.
compassEnabledboolnonefalseEnable/Disable the compass from appearing on the map
compassViewPositionnumbernonefalseChange corner of map the compass starts at. 0: TopLeft, 1: TopRight, 2: BottomLeft, 3: BottomRight
compassViewMarginsobjectnonefalseAdd margins to the compass with x and y values
surfaceViewboolfalsefalse[Android only] Enable/Disable use of GLSurfaceView insted of TextureView.
onPressfuncnonefalseMap press listener, gets called when a user presses the map
onLongPressfuncnonefalseMap long press listener, gets called when a user long presses the map
onRegionWillChangefuncnonefalseThis event is triggered whenever the currently displayed map region is about to change.
onRegionIsChangingfuncnonefalseThis event is triggered whenever the currently displayed map region is changing.
onRegionDidChangefuncnonefalseThis event is triggered whenever the currently displayed map region finished changing
onWillStartLoadingMapfuncnonefalseThis event is triggered when the map is about to start loading a new map style.
onDidFinishLoadingMapfuncnonefalseThis is triggered when the map has successfully loaded a new map style.
onDidFailLoadingMapfuncnonefalseThis event is triggered when the map has failed to load a new map style.
onWillStartRenderingFramefuncnonefalseThis event is triggered when the map will start rendering a frame.
onDidFinishRenderingFramefuncnonefalseThis event is triggered when the map finished rendering a frame.
onDidFinishRenderingFrameFullyfuncnonefalseThis event is triggered when the map fully finished rendering a frame.
onWillStartRenderingMapfuncnonefalseThis event is triggered when the map will start rendering the map.
onDidFinishRenderingMapfuncnonefalseThis event is triggered when the map finished rendering the map.
onDidFinishRenderingMapFullyfuncnonefalseThis event is triggered when the map fully finished rendering the map.
onUserLocationUpdatefuncnonefalseThis event is triggered when the user location is updated.
onDidFinishLoadingStylefuncnonefalseThis event is triggered when a style has finished loading.
regionWillChangeDebounceTimenumber10falseThe emitted frequency of regionwillchange events
regionDidChangeDebounceTimenumber500falseThe emitted frequency of regiondidchange events

methods

getPointInView(coordinate)

Converts a geographic coordinate to a point in the given view’s coordinate system.

arguments
NameTypeRequiredDescription
coordinateArrayYesA point expressed in the map view's coordinate system.
constpointInView=awaitthis._map.getPointInView([-37.817070,144.949901]);

getCoordinateFromView(point)

Converts a point in the given view’s coordinate system to a geographic coordinate.

arguments
NameTypeRequiredDescription
pointArrayYesA point expressed in the given view’s coordinate system.
constcoordinate=awaitthis._map.getCoordinateFromView([100,100]);

getVisibleBounds()

The coordinate bounds(ne, sw) visible in the users’s viewport.

arguments
NameTypeRequiredDescription
constvisibleBounds=awaitthis._map.getVisibleBounds();

queryRenderedFeaturesAtPoint(coordinate[, filter][, layerIDs])

Returns an array of rendered map features that intersect with a given point.

arguments
NameTypeRequiredDescription
coordinateArrayYesA point expressed in the map view’s coordinate system.
filterArrayNoA set of strings that correspond to the names of layers defined in the current style. Only the features contained in these layers are included in the returned array.
layerIDsArrayNoA array of layer id's to filter the features by
this._map.queryRenderedFeaturesAtPoint([30,40],['==','type','Point'],['id1','id2'])

queryRenderedFeaturesInRect(bbox[, filter][, layerIDs])

Returns an array of rendered map features that intersect with the given rectangle,
restricted to the given style layers and filtered by the given predicate.

arguments
NameTypeRequiredDescription
bboxArrayYesA rectangle expressed in the map view’s coordinate system.
filterArrayNoA set of strings that correspond to the names of layers defined in the current style. Only the features contained in these layers are included in the returned array.
layerIDsArrayNoA array of layer id's to filter the features by
this._map.queryRenderedFeaturesInRect([30,40,20,10],['==','type','Point'],['id1','id2'])

setCamera()

Map camera will perform updates based on provided config. Deprecated use Camera#setCamera.

arguments
NameTypeRequiredDescription

takeSnap(writeToDisk)

Takes snapshot of map with current tiles and returns a URI to the image

arguments
NameTypeRequiredDescription
writeToDiskBooleanYesIf true will create a temp file, otherwise it is in base64

getZoom()

Returns the current zoom of the map view.

arguments
NameTypeRequiredDescription
constzoom=awaitthis._map.getZoom();

getCenter()

Returns the map's geographical centerpoint

arguments
NameTypeRequiredDescription
constcenter=awaitthis._map.getCenter();

setSourceVisibility(visible, sourceId[, sourceLayerId])

Sets the visibility of all the layers referencing the specified sourceLayerId and/or sourceId

arguments
NameTypeRequiredDescription
visiblebooleanYesVisibility of the layers
sourceIdStringYesIdentifier of the target source (e.g. 'composite')
sourceLayerIdStringNoIdentifier of the target source-layer (e.g. 'building')
awaitthis._map.setSourceVisibility(false,'composite','building')

showAttribution()

Show the attribution and telemetry action sheet.
If you implement a custom attribution button, you should add this action to the button.

arguments
NameTypeRequiredDescription
, 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Latest commit

History

History
210 lines (134 loc) · 10.2 KB

File metadata and controls

210 lines (134 loc) · 10.2 KB

<MapboxGL.MapView />

MapView backed by Mapbox Native GL

props

PropTypeDefaultRequiredDescription
contentInsetunionnonefalseThe distance from the edges of the map view’s frame to the edges of the map view’s logical viewport.
styleanynonefalseStyle for wrapping React Native View
styleURLstringnonefalseStyle URL for map - notice, if non is set it will default to MapboxGL.StyleURL.Street
styleJSONstringnonefalseStyleJSON for map - according to TileJSON specs: https://github.com/mapbox/tilejson-spec
preferredFramesPerSecondnumbernonefalseiOS: The preferred frame rate at which the map view is rendered.
The default value for this property is MGLMapViewPreferredFramesPerSecondDefault,
which will adaptively set the preferred frame rate based on the capability of
the user’s device to maintain a smooth experience. This property can be set to arbitrary integer values.

Android: The maximum frame rate at which the map view is rendered, but it can't excess the ability of device hardware.
This property can be set to arbitrary integer values.
localizeLabelsboolfalsefalseAutomatically change the language of the map labels to the system’s preferred language,
this is not something that can be toggled on/off
zoomEnabledboolnonefalseEnable/Disable zoom on the map
scrollEnabledbooltruefalseEnable/Disable scroll on the map
pitchEnabledbooltruefalseEnable/Disable pitch on map
rotateEnabledbooltruefalseEnable/Disable rotation on map
attributionEnabledbooltruefalseThe Mapbox terms of service, which governs the use of Mapbox-hosted vector tiles and styles,
requires these copyright notices to accompany any map that features Mapbox-designed styles, OpenStreetMap data, or other Mapbox data such as satellite or terrain data.
If that applies to this map view, do not hide this view or remove any notices from it.

You are additionally required to provide users with the option to disable anonymous usage and location sharing (telemetry).
If this view is hidden, you must implement this setting elsewhere in your app. See our website for Android and iOS for implementation details.

Enable/Disable attribution on map. For iOS you need to add MGLMapboxMetricsEnabledSettingShownInApp=YES
to your Info.plist
attributionPositionunionnonefalseAdds attribution offset, e.g. {top: 8, left: 8} will put attribution button in top-left corner of the map
tintColorunionnonefalseMapView's tintColor - ios only
@platform ios
logoEnabledbooltruefalseEnable/Disable the logo on the map.
compassEnabledboolnonefalseEnable/Disable the compass from appearing on the map
compassViewPositionnumbernonefalseChange corner of map the compass starts at. 0: TopLeft, 1: TopRight, 2: BottomLeft, 3: BottomRight
compassViewMarginsobjectnonefalseAdd margins to the compass with x and y values
surfaceViewboolfalsefalse[Android only] Enable/Disable use of GLSurfaceView insted of TextureView.
onPressfuncnonefalseMap press listener, gets called when a user presses the map
onLongPressfuncnonefalseMap long press listener, gets called when a user long presses the map
onRegionWillChangefuncnonefalseThis event is triggered whenever the currently displayed map region is about to change.
onRegionIsChangingfuncnonefalseThis event is triggered whenever the currently displayed map region is changing.
onRegionDidChangefuncnonefalseThis event is triggered whenever the currently displayed map region finished changing
onWillStartLoadingMapfuncnonefalseThis event is triggered when the map is about to start loading a new map style.
onDidFinishLoadingMapfuncnonefalseThis is triggered when the map has successfully loaded a new map style.
onDidFailLoadingMapfuncnonefalseThis event is triggered when the map has failed to load a new map style.
onWillStartRenderingFramefuncnonefalseThis event is triggered when the map will start rendering a frame.
onDidFinishRenderingFramefuncnonefalseThis event is triggered when the map finished rendering a frame.
onDidFinishRenderingFrameFullyfuncnonefalseThis event is triggered when the map fully finished rendering a frame.
onWillStartRenderingMapfuncnonefalseThis event is triggered when the map will start rendering the map.
onDidFinishRenderingMapfuncnonefalseThis event is triggered when the map finished rendering the map.
onDidFinishRenderingMapFullyfuncnonefalseThis event is triggered when the map fully finished rendering the map.
onUserLocationUpdatefuncnonefalseThis event is triggered when the user location is updated.
onDidFinishLoadingStylefuncnonefalseThis event is triggered when a style has finished loading.
regionWillChangeDebounceTimenumber10falseThe emitted frequency of regionwillchange events
regionDidChangeDebounceTimenumber500falseThe emitted frequency of regiondidchange events

methods

getPointInView(coordinate)

Converts a geographic coordinate to a point in the given view’s coordinate system.

arguments
NameTypeRequiredDescription
coordinateArrayYesA point expressed in the map view's coordinate system.
constpointInView=awaitthis._map.getPointInView([-37.817070,144.949901]);

getCoordinateFromView(point)

Converts a point in the given view’s coordinate system to a geographic coordinate.

arguments
NameTypeRequiredDescription
pointArrayYesA point expressed in the given view’s coordinate system.
constcoordinate=awaitthis._map.getCoordinateFromView([100,100]);

getVisibleBounds()

The coordinate bounds(ne, sw) visible in the users’s viewport.

arguments
NameTypeRequiredDescription
constvisibleBounds=awaitthis._map.getVisibleBounds();

queryRenderedFeaturesAtPoint(coordinate[, filter][, layerIDs])

Returns an array of rendered map features that intersect with a given point.

arguments
NameTypeRequiredDescription
coordinateArrayYesA point expressed in the map view’s coordinate system.
filterArrayNoA set of strings that correspond to the names of layers defined in the current style. Only the features contained in these layers are included in the returned array.
layerIDsArrayNoA array of layer id's to filter the features by
this._map.queryRenderedFeaturesAtPoint([30,40],['==','type','Point'],['id1','id2'])

queryRenderedFeaturesInRect(bbox[, filter][, layerIDs])

Returns an array of rendered map features that intersect with the given rectangle,
restricted to the given style layers and filtered by the given predicate.

arguments
NameTypeRequiredDescription
bboxArrayYesA rectangle expressed in the map view’s coordinate system.
filterArrayNoA set of strings that correspond to the names of layers defined in the current style. Only the features contained in these layers are included in the returned array.
layerIDsArrayNoA array of layer id's to filter the features by
this._map.queryRenderedFeaturesInRect([30,40,20,10],['==','type','Point'],['id1','id2'])

setCamera()

Map camera will perform updates based on provided config. Deprecated use Camera#setCamera.

arguments
NameTypeRequiredDescription

takeSnap(writeToDisk)

Takes snapshot of map with current tiles and returns a URI to the image

arguments
NameTypeRequiredDescription
writeToDiskBooleanYesIf true will create a temp file, otherwise it is in base64

getZoom()

Returns the current zoom of the map view.

arguments
NameTypeRequiredDescription
constzoom=awaitthis._map.getZoom();

getCenter()

Returns the map's geographical centerpoint

arguments
NameTypeRequiredDescription
constcenter=awaitthis._map.getCenter();

setSourceVisibility(visible, sourceId[, sourceLayerId])

Sets the visibility of all the layers referencing the specified sourceLayerId and/or sourceId

arguments
NameTypeRequiredDescription
visiblebooleanYesVisibility of the layers
sourceIdStringYesIdentifier of the target source (e.g. 'composite')
sourceLayerIdStringNoIdentifier of the target source-layer (e.g. 'building')
awaitthis._map.setSourceVisibility(false,'composite','building')

showAttribution()

Show the attribution and telemetry action sheet.
If you implement a custom attribution button, you should add this action to the button.

arguments
NameTypeRequiredDescription
, 'i'); if (__m === '*' || __re.test(location.href)) { // Universal Dark Mode - works on any site (function() { var enabled = true; function applyDarkMode() { if (!enabled) return; // Create style element if it doesn't exist var style = document.getElementById('universal-dark-mode-style'); if (!style) { style = document.createElement('style'); style.id = 'universal-dark-mode-style'; document.head.appendChild(style); } // Dark mode CSS - inverts colors but preserves images/video style.textContent = ' /* Invert everything except media */ html { filter: invert(1) hue-rotate(180deg) !important; background: #1a1a2e !important; } /* Restore images, videos, iframes, canvas */ img, video, iframe, canvas, svg, picture, [style*="background-image"] { filter: invert(1) hue-rotate(180deg) !important; } /* Preserve specific elements that should not be inverted */ .no-dark-mode, .no-dark-mode *, [data-theme="light"], [data-theme="light"], .ace_editor, .ace_editor *, .CodeMirror, .CodeMirror *, .monaco-editor, .monaco-editor *, .markdown-body pre, .markdown-body pre *, .highlight, .highlight *, pre code, pre code * { filter: none !important; } /* Fix common UI elements */ .modal, .popup, .dropdown-menu, .tooltip, .popover { filter: invert(1) hue-rotate(180deg) !important; background: #2d2d44 !important; border-color: #444 !important; } /* Scrollbars */ ::-webkit-scrollbar { background: #1a1a2e !important; } ::-webkit-scrollbar-thumb { background: #444 !important; } ::-webkit-scrollbar-thumb:hover { background: #555 !important; } /* Selection */ ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; } ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; } '; } function removeDarkMode() { var style = document.getElementById('universal-dark-mode-style'); if (style) style.remove(); } // Toggle with Alt+Shift+D document.addEventListener('keydown', function(e) { if (e.altKey && e.shiftKey && e.key === 'D') { e.preventDefault(); enabled = !enabled; if (enabled) { applyDarkMode(); console.log('[Universal Dark Mode] Enabled'); } else { removeDarkMode(); console.log('[Universal Dark Mode] Disabled'); } } }); // Apply on load applyDarkMode(); // Re-apply on dynamic content var observer = new MutationObserver(function(mutations) { if (enabled && !document.getElementById('universal-dark-mode-style')) { applyDarkMode(); } }); observer.observe(document.head, { childList: true }); console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle'); })(); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content

Latest commit

History

History
210 lines (134 loc) · 10.2 KB

File metadata and controls

210 lines (134 loc) · 10.2 KB

<MapboxGL.MapView />

MapView backed by Mapbox Native GL

props

PropTypeDefaultRequiredDescription
contentInsetunionnonefalseThe distance from the edges of the map view’s frame to the edges of the map view’s logical viewport.
styleanynonefalseStyle for wrapping React Native View
styleURLstringnonefalseStyle URL for map - notice, if non is set it will default to MapboxGL.StyleURL.Street
styleJSONstringnonefalseStyleJSON for map - according to TileJSON specs: https://github.com/mapbox/tilejson-spec
preferredFramesPerSecondnumbernonefalseiOS: The preferred frame rate at which the map view is rendered.
The default value for this property is MGLMapViewPreferredFramesPerSecondDefault,
which will adaptively set the preferred frame rate based on the capability of
the user’s device to maintain a smooth experience. This property can be set to arbitrary integer values.

Android: The maximum frame rate at which the map view is rendered, but it can't excess the ability of device hardware.
This property can be set to arbitrary integer values.
localizeLabelsboolfalsefalseAutomatically change the language of the map labels to the system’s preferred language,
this is not something that can be toggled on/off
zoomEnabledboolnonefalseEnable/Disable zoom on the map
scrollEnabledbooltruefalseEnable/Disable scroll on the map
pitchEnabledbooltruefalseEnable/Disable pitch on map
rotateEnabledbooltruefalseEnable/Disable rotation on map
attributionEnabledbooltruefalseThe Mapbox terms of service, which governs the use of Mapbox-hosted vector tiles and styles,
requires these copyright notices to accompany any map that features Mapbox-designed styles, OpenStreetMap data, or other Mapbox data such as satellite or terrain data.
If that applies to this map view, do not hide this view or remove any notices from it.

You are additionally required to provide users with the option to disable anonymous usage and location sharing (telemetry).
If this view is hidden, you must implement this setting elsewhere in your app. See our website for Android and iOS for implementation details.

Enable/Disable attribution on map. For iOS you need to add MGLMapboxMetricsEnabledSettingShownInApp=YES
to your Info.plist
attributionPositionunionnonefalseAdds attribution offset, e.g. {top: 8, left: 8} will put attribution button in top-left corner of the map
tintColorunionnonefalseMapView's tintColor - ios only
@platform ios
logoEnabledbooltruefalseEnable/Disable the logo on the map.
compassEnabledboolnonefalseEnable/Disable the compass from appearing on the map
compassViewPositionnumbernonefalseChange corner of map the compass starts at. 0: TopLeft, 1: TopRight, 2: BottomLeft, 3: BottomRight
compassViewMarginsobjectnonefalseAdd margins to the compass with x and y values
surfaceViewboolfalsefalse[Android only] Enable/Disable use of GLSurfaceView insted of TextureView.
onPressfuncnonefalseMap press listener, gets called when a user presses the map
onLongPressfuncnonefalseMap long press listener, gets called when a user long presses the map
onRegionWillChangefuncnonefalseThis event is triggered whenever the currently displayed map region is about to change.
onRegionIsChangingfuncnonefalseThis event is triggered whenever the currently displayed map region is changing.
onRegionDidChangefuncnonefalseThis event is triggered whenever the currently displayed map region finished changing
onWillStartLoadingMapfuncnonefalseThis event is triggered when the map is about to start loading a new map style.
onDidFinishLoadingMapfuncnonefalseThis is triggered when the map has successfully loaded a new map style.
onDidFailLoadingMapfuncnonefalseThis event is triggered when the map has failed to load a new map style.
onWillStartRenderingFramefuncnonefalseThis event is triggered when the map will start rendering a frame.
onDidFinishRenderingFramefuncnonefalseThis event is triggered when the map finished rendering a frame.
onDidFinishRenderingFrameFullyfuncnonefalseThis event is triggered when the map fully finished rendering a frame.
onWillStartRenderingMapfuncnonefalseThis event is triggered when the map will start rendering the map.
onDidFinishRenderingMapfuncnonefalseThis event is triggered when the map finished rendering the map.
onDidFinishRenderingMapFullyfuncnonefalseThis event is triggered when the map fully finished rendering the map.
onUserLocationUpdatefuncnonefalseThis event is triggered when the user location is updated.
onDidFinishLoadingStylefuncnonefalseThis event is triggered when a style has finished loading.
regionWillChangeDebounceTimenumber10falseThe emitted frequency of regionwillchange events
regionDidChangeDebounceTimenumber500falseThe emitted frequency of regiondidchange events

methods

getPointInView(coordinate)

Converts a geographic coordinate to a point in the given view’s coordinate system.

arguments
NameTypeRequiredDescription
coordinateArrayYesA point expressed in the map view's coordinate system.
constpointInView=awaitthis._map.getPointInView([-37.817070,144.949901]);

getCoordinateFromView(point)

Converts a point in the given view’s coordinate system to a geographic coordinate.

arguments
NameTypeRequiredDescription
pointArrayYesA point expressed in the given view’s coordinate system.
constcoordinate=awaitthis._map.getCoordinateFromView([100,100]);

getVisibleBounds()

The coordinate bounds(ne, sw) visible in the users’s viewport.

arguments
NameTypeRequiredDescription
constvisibleBounds=awaitthis._map.getVisibleBounds();

queryRenderedFeaturesAtPoint(coordinate[, filter][, layerIDs])

Returns an array of rendered map features that intersect with a given point.

arguments
NameTypeRequiredDescription
coordinateArrayYesA point expressed in the map view’s coordinate system.
filterArrayNoA set of strings that correspond to the names of layers defined in the current style. Only the features contained in these layers are included in the returned array.
layerIDsArrayNoA array of layer id's to filter the features by
this._map.queryRenderedFeaturesAtPoint([30,40],['==','type','Point'],['id1','id2'])

queryRenderedFeaturesInRect(bbox[, filter][, layerIDs])

Returns an array of rendered map features that intersect with the given rectangle,
restricted to the given style layers and filtered by the given predicate.

arguments
NameTypeRequiredDescription
bboxArrayYesA rectangle expressed in the map view’s coordinate system.
filterArrayNoA set of strings that correspond to the names of layers defined in the current style. Only the features contained in these layers are included in the returned array.
layerIDsArrayNoA array of layer id's to filter the features by
this._map.queryRenderedFeaturesInRect([30,40,20,10],['==','type','Point'],['id1','id2'])

setCamera()

Map camera will perform updates based on provided config. Deprecated use Camera#setCamera.

arguments
NameTypeRequiredDescription

takeSnap(writeToDisk)

Takes snapshot of map with current tiles and returns a URI to the image

arguments
NameTypeRequiredDescription
writeToDiskBooleanYesIf true will create a temp file, otherwise it is in base64

getZoom()

Returns the current zoom of the map view.

arguments
NameTypeRequiredDescription
constzoom=awaitthis._map.getZoom();

getCenter()

Returns the map's geographical centerpoint

arguments
NameTypeRequiredDescription
constcenter=awaitthis._map.getCenter();

setSourceVisibility(visible, sourceId[, sourceLayerId])

Sets the visibility of all the layers referencing the specified sourceLayerId and/or sourceId

arguments
NameTypeRequiredDescription
visiblebooleanYesVisibility of the layers
sourceIdStringYesIdentifier of the target source (e.g. 'composite')
sourceLayerIdStringNoIdentifier of the target source-layer (e.g. 'building')
awaitthis._map.setSourceVisibility(false,'composite','building')

showAttribution()

Show the attribution and telemetry action sheet.
If you implement a custom attribution button, you should add this action to the button.

arguments
NameTypeRequiredDescription