Skip to content

Commit

Permalink
Remove custom source work
Browse files Browse the repository at this point in the history
  • Loading branch information
Lauren Budorick committed Mar 8, 2018
1 parent 1ae9400 commit a3be215
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 219 deletions.
60 changes: 28 additions & 32 deletions debug/routeline.html → debug/gradient.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
<div id='map'></div>

<script src='/dist/mapbox-gl-dev.js'></script>
<script src='/dist/mapbox-gl-linestring.js'></script>
<script src='/debug/access_token_generated.js'></script>
<script>

Expand All @@ -42,38 +41,35 @@
map.on('load', () => {
map.showTileBoundaries = true;

map.addSourceType('linestring', mapboxgl.LineStringSource, (e) => {

map.addSource('line', {
type: 'linestring',
buffer: 0,
data: gj
});
map.addSource('line', {
type: 'geojson',
lineMetrics: true,
data: gj
});

map.addLayer({
type: 'line',
source: 'line',
id: 'line',
paint: {
'line-color': 'red',
'line-width': 14,
'line-gradient': [
'interpolate',
['linear'],
['line-progress'],
0, "rgba(0, 0, 255, 0)",
0.1, "royalblue",
0.3, "cyan",
0.5, "lime",
0.7, "yellow",
1, "red"
]
},
layout: {
'line-cap': 'round',
'line-join': 'round'
}
});
map.addLayer({
type: 'line',
source: 'line',
id: 'line',
paint: {
'line-color': 'red',
'line-width': 14,
'line-gradient': [
'interpolate',
['linear'],
['line-progress'],
0, "rgba(0, 0, 255, 0)",
0.1, "royalblue",
0.3, "cyan",
0.5, "lime",
0.7, "yellow",
1, "red"
]
},
layout: {
'line-cap': 'round',
'line-join': 'round'
}
});
});

Expand Down
3 changes: 2 additions & 1 deletion flow-typed/style-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,8 @@ declare type LineLayerSpecification = {|
"line-offset"?: DataDrivenPropertyValueSpecification<number>,
"line-blur"?: DataDrivenPropertyValueSpecification<number>,
"line-dasharray"?: PropertyValueSpecification<Array<number>>,
"line-pattern"?: PropertyValueSpecification<string>
"line-pattern"?: PropertyValueSpecification<string>,
"line-gradient"?: ExpressionSpecification
|}
|}

Expand Down
84 changes: 0 additions & 84 deletions linestring/linestring_source.js

This file was deleted.

95 changes: 0 additions & 95 deletions linestring/linestring_worker.js

This file was deleted.

4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,7 @@
"test-flow-cov": "flow-coverage-report -i 'src/**/*.js' -t html",
"test-cov": "nyc --require=flow-remove-types/register --reporter=text-summary --reporter=lcov --cache run-s test-unit test-expressions test-query test-render",
"prepublish": "in-publish && run-s build-dev build-min || not-in-publish",
"codegen": "node build/generate-style-code.js && flow-node build/generate-struct-arrays.js",
"linestring": "browserify -s mapboxgl.LineStringSource linestring/linestring_source.js > dist/mapbox-gl-linestring.js",
"linestring-watch": "watchify -s mapboxgl.LineStringSource linestring/linestring_source.js --outfile dist/mapbox-gl-linestring.js"
"codegen": "node build/generate-style-code.js && flow-node build/generate-struct-arrays.js"
},
"files": [
"build/",
Expand Down
2 changes: 1 addition & 1 deletion src/source/geojson_source.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ class GeoJSONSource extends Evented implements Source {
tolerance: (options.tolerance !== undefined ? options.tolerance : 0.375) * scale,
extent: EXTENT,
maxZoom: this.maxzoom,
lineMetrics: options.lineMetrics
lineMetrics: options.lineMetrics || false
},
superclusterOptions: {
maxZoom: options.clusterMaxZoom !== undefined ?
Expand Down
3 changes: 2 additions & 1 deletion test/unit/source/geojson_source.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,8 @@ test('GeoJSONSource#update', (t) => {
extent: 8192,
maxZoom: 10,
tolerance: 4,
buffer: 256
buffer: 256,
lineMetrics: false
});
t.end();
}
Expand Down
8 changes: 6 additions & 2 deletions test/unit/style-spec/fixture/layers.output.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,11 @@
"line": 95
},
{
"message": "layers[15]: layer \"line-gradient-bad\" specifies a line-gradient, which requires a GeoJSON source",
"message": "layers[15]: layer \"line-gradient-bad\" specifies a line-gradient, which requires a GeoJSON source with `lineMetrics` enabled.",
"line": 107
},
{
"message": "layers[16]: layer \"line-gradient-good\" specifies a line-gradient, which requires a GeoJSON source with `lineMetrics` enabled.",
"line": 121
}
]
]

0 comments on commit a3be215

Please sign in to comment.