Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Add example: animate a line #3788

Closed
wants to merge 61 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
5d91cca
add animate a line example
YunjieLi Dec 13, 2016
551ba96
simplify interactions; style change
YunjieLi Dec 15, 2016
562debb
inactive tab fix
YunjieLi Dec 15, 2016
ff54243
added inactive tab support, tweaking pause button
YunjieLi Jan 23, 2017
5fd754b
fix inactive tab, add pause/play button, worldcopies to false
YunjieLi Jan 25, 2017
5a3372c
remove flyTo
YunjieLi Jan 26, 2017
4701895
fix yarn.lock after adding stylelint (#4672)
pirxpilot May 4, 2017
44641e9
Enable image tests for native (#4654)
May 4, 2017
3261d29
skip pattern layer when pattern is missing
ansis May 8, 2017
8b085a2
Add regression test for https://github.com/mapbox/mapbox-gl-native/is…
jfirebaugh May 11, 2017
9461917
Add regression test for https://github.com/mapbox/mapbox-gl-native/is…
jfirebaugh May 10, 2017
0e0f2e5
Remove integration tests using paint classes
jfirebaugh May 10, 2017
9dc82f6
Remove obsolete modular arithmetic on atlas coordinates
jfirebaugh May 16, 2017
c1405e7
Move pattern coordinate division by texture size into shader
jfirebaugh May 18, 2017
ca1d581
Ensure symbol shader attrib bound at 0 is always valid and used (#4688)
May 19, 2017
1f3000c
Fix bug with rerendering after webglcontexlost
May 19, 2017
18f7c51
Also reset frameId in the other place a frame is cancelled
jfirebaugh May 19, 2017
a1f4938
Disable letter-spacing for Arabic text (issue #4208)
ChrisLoer May 19, 2017
5b14f36
Fix typo in equalWithPrecision assertion
IvanSanchez May 22, 2017
c9b1c3a
Sanitize flyto's zoom parameter to clamp between map's minzoom and ma…
IvanSanchez May 19, 2017
92fafd0
Added unit tests for flyTo min/maxZoom clamping
IvanSanchez May 22, 2017
4a85df6
Enable gl-native test for Arabic letter-spacing (#9057)
ChrisLoer May 20, 2017
02dfbb1
fix wordmark in IE (#4741)
mollymerp May 23, 2017
c728137
Remove destructuring assignment, per CONTRIBUTING.md
jfirebaugh May 22, 2017
5afdc76
Simplify and fix sprite atlas coordinate calculations
jfirebaugh May 19, 2017
feb84c8
Add tests for 1.5x image
jfirebaugh May 20, 2017
ca1e1cf
Enable passing test in gl-native
jfirebaugh May 22, 2017
45ba76f
Render benchmark results in a more compact table format
jfirebaugh May 23, 2017
c43c2fc
Remove autoscrolling; doesn't work well in table layout
jfirebaugh May 23, 2017
6daed99
Add links to run individual benchmarks
jfirebaugh May 23, 2017
8214c00
showCollisionBoxes fix (#4689)
mollymerp May 24, 2017
bb831bf
stop using standard path module
pirxpilot Apr 30, 2017
cb84e67
Require node 6; permit default and rest params and destructuring
jfirebaugh May 25, 2017
ecede38
Use rest parameters
jfirebaugh May 25, 2017
010f425
Use destructuring
jfirebaugh May 25, 2017
a267c4b
Fix "labelMinScale" logic in getGlyphQuads:
ChrisLoer Apr 13, 2017
28a7a07
Fix comment: Tile.coord is a TileCoord, not a Coordinate
ChrisLoer Apr 26, 2017
1b615fd
Make render test summary failures searchable
ChrisLoer Apr 27, 2017
df738b9
Recalculate collision box shape at placement time based on distance f…
ChrisLoer Mar 29, 2017
f47aea9
Fix short-circuit guard for queries against empty collision tiles. `g…
ChrisLoer Mar 29, 2017
8863798
Attenuate the effect of perspective on label scale:
ChrisLoer Mar 29, 2017
a72aab7
Standardizing on highp precision based on discussion in https://githu…
ChrisLoer Mar 29, 2017
489724a
Generate line collision boxes for scales < 1.
ChrisLoer Mar 29, 2017
aefb3ee
Throttle symbol re-placement to once every 300ms.
ChrisLoer May 24, 2017
ff159e2
Support pitch-scaling attenuation behavior in debug collision boxes.
ChrisLoer Mar 29, 2017
b512804
Add 'max-camera-distance' uniform for hiding labels in the distance t…
ChrisLoer May 12, 2017
6df20ce
Render tests for icon and text pitch scaling.
ChrisLoer Mar 29, 2017
a52cfec
Update existing pitched map text rendering tests to match new pitched…
ChrisLoer Mar 29, 2017
24bad96
Fix type info in comments: Coordinate -> TileCoord
ChrisLoer May 22, 2017
6b15667
Small performance enhancement: don't add "pitch padding" boxes for li…
ChrisLoer May 23, 2017
1a16b44
Don't reuse wrapped tiles in SourceCache.
ChrisLoer May 24, 2017
3487c8f
Add pitched-collision render tests, including case of wrapped tiles.
ChrisLoer May 24, 2017
2be1b58
Tiny shader logic simplification.
ChrisLoer May 24, 2017
73065fa
Make debug collision boxes use same fade texture as the symbols.
ChrisLoer May 24, 2017
a6a6b0d
Make perspective_zoom_adjust use the same .1 precision used by labelm…
ChrisLoer May 25, 2017
10eb02b
Add simple CanvasSource debug page.
ChrisLoer May 25, 2017
f482f18
light.anchor: zoom (piecewise-constant) functions supported (#4757)
May 25, 2017
cb34199
fix thrown exception with certain calls to flyTo (#4761)
mollymerp May 29, 2017
7d2b30b
fix update edit link, add query parameters for map feedback (#4685)
mollymerp May 31, 2017
943dc39
Enable ImageSource integration tests for Native (#4774)
Jun 2, 2017
4538224
Merge branch 'master' into example-line-animation
Jun 2, 2017
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
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,11 @@ See [`bench/README.md`](https://github.com/mapbox/mapbox-gl-js/blob/master/bench
* Classes
* Template strings
* Computed and shorthand object properties
* The following ES6 features are not to be used, in order to maintain support for Node 4.x, IE 11, and older mobile browsers. This may change in the future.
* Default parameters
* Rest parameters
* Spread (`...`) operator
* Destructuring
* The following ES6 features are not to be used, in order to maintain support for IE 11 and older mobile browsers. This may change in the future.
* Spread (`...`) operator (because it requires Object.assign)
* Iterators and generators
* "Library" features such as `Map`, `Set`, `array.find`, etc.
* Modules
Expand Down
120 changes: 40 additions & 80 deletions bench/benchmarks_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,58 +12,55 @@ const BenchmarksView = React.createClass({

render: function() {
return <div style={{width: 960, paddingBottom: window.innerHeight, margin: '0 auto'}}>
{this.renderSidebarBenchmarks()}
{this.renderBenchmarks()}
</div>;
},

renderSidebarBenchmarks: function() {
return <div style={{paddingTop: 40, width: 280, position: 'fixed'}} className='text-right'>
<h1 className="space-bottom">Benchmarks</h1>
<div className="space-bottom small">
{Object.keys(this.state.results).map(this.renderSidebarBenchmark)}
</div>
<a
<h1 className="space-bottom">
Benchmarks
<a
className={[
'fr',
'icon',
'clipboard',
'button',
(this.getStatus() === 'ended' ? '' : 'disabled')
].join(' ')}
data-clipboard-text={this.renderTextBenchmarks()}>
Copy Results
</a>
Copy Results
</a>
</h1>
<table>
<thead>
<tr>
<th>Benchmark</th>
{this.versions().map((v) => <th key={v}>{v}</th>)}
</tr>
</thead>
<tbody>
{Object.keys(this.state.results).map(this.renderBenchmark)}
</tbody>
</table>
</div>;
},

renderSidebarBenchmark: function(name) {
return <div
key={name}
className={[
'space-bottom',
this.getBenchmarkStatus(name) === 'waiting' ? 'quiet' : ''
].join(' ')}>
<h3>{name}</h3>
{Object.keys(this.state.results[name]).map(this.renderSidebarBenchmarkVersion.bind(this, name))}
</div>;
renderBenchmark: function(name) {
return <tr key={name}>
<th><a href={`#${name}`} onClick={this.reload}>{name}</a></th>
{Object.keys(this.state.results[name]).map(this.renderBenchmarkVersion.bind(this, name))}
</tr>;
},

renderSidebarBenchmarkVersion: function(name, version) {
renderBenchmarkVersion: function(name, version) {
const results = this.state.results[name][version];
const that = this;

return <div
onClick={function() {
that.scrollToBenchmark(name, version);
}}
style={{cursor: 'pointer'}}
return (
<td id={name + version}
key={version}
className={results.status === 'waiting' ? 'quiet' : ''}>
<strong>{version}:</strong> {results.message || '...'}
</div>;
{results.logs.map((log, index) => {
return <div key={index} className={`pad1 dark fill-${log.color}`}>{log.message}</div>;
})}
</td>
);
},

renderTextBenchmarks: function() {
versions: function() {
const versions = [];
for (const name in this.state.results) {
for (const version in this.state.results[name]) {
Expand All @@ -72,7 +69,11 @@ const BenchmarksView = React.createClass({
}
}
}
return versions;
},

renderTextBenchmarks: function() {
const versions = this.versions();
let output = `benchmark | ${versions.join(' | ')}\n---`;
for (let i = 0; i < versions.length; i++) {
output += ' | ---';
Expand All @@ -90,49 +91,6 @@ const BenchmarksView = React.createClass({
return output;
},

renderBenchmarks: function() {
return <div style={{width: 590, marginLeft: 320, marginBottom: 60}}>
{Object.keys(this.state.results).map(this.renderBenchmark)}
</div>;
},

renderBenchmark: function(name) {
return <div key={name}>
{Object.keys(this.state.results[name]).map(this.renderBenchmarkVersion.bind(this, name))}
</div>;
},

renderBenchmarkVersion: function(name, version) {
const results = this.state.results[name][version];
return (
<div
style={{paddingTop: 40}}
id={name + version}
key={version}
className={results.status === 'waiting' ? 'quiet' : ''}>

<h2 className='space-bottom'>{name} on {version}</h2>
{results.logs.map((log, index) => {
return <div key={index} className={`pad1 dark fill-${log.color}`}>{log.message}</div>;
})}
</div>
);
},

scrollToBenchmark: function(name, version) {
const duration = 300;
const startTime = (new Date()).getTime();
const startYOffset = window.pageYOffset;

requestAnimationFrame(function frame() {
const endYOffset = document.getElementById(name + version).offsetTop;
const time = (new Date()).getTime();
const yOffset = Math.min((time - startTime) / duration, 1) * (endYOffset - startYOffset) + startYOffset;
window.scrollTo(0, yOffset);
if (time < startTime + duration) requestAnimationFrame(frame);
});
},

getInitialState: function() {
const results = {};

Expand All @@ -156,7 +114,6 @@ const BenchmarksView = React.createClass({

asyncSeries(Object.keys(that.state.results), (name, callback) => {
asyncSeries(Object.keys(that.state.results[name]), (version, callback) => {
that.scrollToBenchmark(name, version);
that.runBenchmark(name, version, callback);
}, callback);
}, (err) => {
Expand All @@ -181,7 +138,6 @@ const BenchmarksView = React.createClass({
}

results.status = 'running';
this.scrollToBenchmark(name, version);
log('dark', 'starting');

setTimeout(() => {
Expand Down Expand Up @@ -223,6 +179,10 @@ const BenchmarksView = React.createClass({
return reduceStatuses(Object.keys(this.state.results).map(function(name) {
return this.getBenchmarkStatus(name);
}, this));
},

reload() {
location.reload();
}
});

Expand Down
80 changes: 80 additions & 0 deletions debug/canvas.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<!DOCTYPE html>
<html>
<head>
<title>Mapbox GL JS debug page</title>
<meta charset='utf-8'>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<link rel='stylesheet' href='/dist/mapbox-gl.css' />
<style>
body { margin: 0; padding: 0; }
html, body, #map { height: 100%; }
</style>
</head>

<body>
<canvas id="testCanvasID" width="200" height="100"
style="border:10px solid blue;">
Canvas not supported
</canvas>
<div id='map'></div>

<script type="application/javascript">
function drawToCanvas() {
var canvas = document.getElementById('testCanvasID');
if (canvas.getContext) {
var ctx = canvas.getContext('2d');

ctx.fillStyle = 'rgb(200, 0, 0)';
ctx.fillRect(10, 10, 50, 50);

ctx.fillStyle = 'rgba(0, 0, 200, 0.5)';
ctx.fillRect(30, 30, 50, 50);
}
}
</script>
<script src='/dist/mapbox-gl-dev.js'></script>
<script src='/debug/access_token_generated.js'></script>
<script>

var canvasStyle = {
"version": 8,
"sources": {
"canvas": {
"type": "canvas",
"canvas": "testCanvasID",
"coordinates": [
[-122.51596391201019, 37.56238816766053],
[-122.51467645168304, 37.56410183312965],
[-122.51309394836426, 37.563391708549425],
[-122.51423120498657, 37.56161849366671]
]
}
},
"layers": [{
"id": "background",
"type": "background",
"paint": {
"background-color": "rgb(4,7,14)"
}
}, {
"id": "canvas",
"type": "raster",
"source": "canvas"
}]
};

var map = new mapboxgl.Map({
container: 'map',
minZoom: 14,
zoom: 17,
center: [-122.514426, 37.562984],
bearing: -96,
style: canvasStyle,
hash: false
});

drawToCanvas();

</script>
</body>
</html>
Loading