Skip to content

Commit 5e807f5

Browse files
author
Brandon Tilley
committed
v1.1.0
1 parent cfb0593 commit 5e807f5

File tree

9 files changed

+60
-19
lines changed

9 files changed

+60
-19
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
v1.1.0 (2014/02/03)
2+
-------------------
3+
14
* Add `stop` method to Planet API
25

36
v1.0.3 (2014/01/23)

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "planetary.js",
3-
"version": "1.0.3",
3+
"version": "1.1.0",
44
"main": "dist/planetaryjs.min.js",
55
"description": "Awesome interactive globes for the web",
66
"homepage": "http://planetaryjs.com",

dist/planetaryjs-noplugins.js

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
/*! Planetary.js v1.0.3
1+
/*! Planetary.js v1.1.0
22
* Copyright (c) 2013 Brandon Tilley
33
*
44
* Released under the MIT license
5-
* Date: 2014-01-23T04:43:43.546Z
5+
* Date: 2014-02-03T08:15:07.064Z
66
*/
77
(function (root, factory) {
88
if (typeof define === 'function' && define.amd) {
@@ -21,6 +21,10 @@
2121

2222
var doDrawLoop = function(planet, canvas, hooks) {
2323
d3.timer(function() {
24+
if (planet.stopped) {
25+
return true;
26+
}
27+
2428
planet.context.clearRect(0, 0, canvas.width, canvas.height);
2529
for (var i = 0; i < hooks.onDraw.length; i++) {
2630
hooks.onDraw[i]();
@@ -76,11 +80,14 @@
7680
};
7781

7882
var startDraw = function(planet, canvas, localPlugins, hooks) {
79-
initPlugins(planet, localPlugins);
80-
8183
planet.canvas = canvas;
8284
planet.context = canvas.getContext('2d');
8385

86+
if (planet.stopped !== true) {
87+
initPlugins(planet, localPlugins);
88+
}
89+
90+
planet.stopped = false;
8491
runOnInitHooks(planet, canvas, hooks);
8592
};
8693

@@ -100,7 +107,8 @@
100107
var localPlugins = [];
101108
var hooks = {
102109
onInit: [],
103-
onDraw: []
110+
onDraw: [],
111+
onStop: []
104112
};
105113

106114
var planet = {
@@ -118,10 +126,21 @@
118126
hooks.onDraw.push(fn);
119127
},
120128

129+
onStop: function(fn) {
130+
hooks.onStop.push(fn);
131+
},
132+
121133
loadPlugin: function(plugin) {
122134
localPlugins.push(plugin);
123135
},
124136

137+
stop: function() {
138+
planet.stopped = true;
139+
for (var i = 0; i < hooks.onStop.length; i++) {
140+
hooks.onStop[i](planet);
141+
}
142+
},
143+
125144
withSavedContext: function(fn) {
126145
if (!this.context) {
127146
throw new Error("No canvas to fetch context for");

dist/planetaryjs-noplugins.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/planetaryjs.js

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
/*! Planetary.js v1.0.3
1+
/*! Planetary.js v1.1.0
22
* Copyright (c) 2013 Brandon Tilley
33
*
44
* Released under the MIT license
5-
* Date: 2014-01-23T04:43:43.371Z
5+
* Date: 2014-02-03T08:15:06.913Z
66
*/
77
(function (root, factory) {
88
if (typeof define === 'function' && define.amd) {
@@ -21,6 +21,10 @@
2121

2222
var doDrawLoop = function(planet, canvas, hooks) {
2323
d3.timer(function() {
24+
if (planet.stopped) {
25+
return true;
26+
}
27+
2428
planet.context.clearRect(0, 0, canvas.width, canvas.height);
2529
for (var i = 0; i < hooks.onDraw.length; i++) {
2630
hooks.onDraw[i]();
@@ -76,11 +80,14 @@
7680
};
7781

7882
var startDraw = function(planet, canvas, localPlugins, hooks) {
79-
initPlugins(planet, localPlugins);
80-
8183
planet.canvas = canvas;
8284
planet.context = canvas.getContext('2d');
8385

86+
if (planet.stopped !== true) {
87+
initPlugins(planet, localPlugins);
88+
}
89+
90+
planet.stopped = false;
8491
runOnInitHooks(planet, canvas, hooks);
8592
};
8693

@@ -100,7 +107,8 @@
100107
var localPlugins = [];
101108
var hooks = {
102109
onInit: [],
103-
onDraw: []
110+
onDraw: [],
111+
onStop: []
104112
};
105113

106114
var planet = {
@@ -118,10 +126,21 @@
118126
hooks.onDraw.push(fn);
119127
},
120128

129+
onStop: function(fn) {
130+
hooks.onStop.push(fn);
131+
},
132+
121133
loadPlugin: function(plugin) {
122134
localPlugins.push(plugin);
123135
},
124136

137+
stop: function() {
138+
planet.stopped = true;
139+
for (var i = 0; i < hooks.onStop.length; i++) {
140+
hooks.onStop[i](planet);
141+
}
142+
},
143+
125144
withSavedContext: function(fn) {
126145
if (!this.context) {
127146
throw new Error("No canvas to fetch context for");

dist/planetaryjs.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "planetary.js",
3-
"version": "1.0.3",
3+
"version": "1.1.0",
44
"description": "Awesome interactive globes for the web",
55
"main": "dist/planetaryjs",
66
"scripts": {

site/public/download/_data.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"stable": {
33
"latest": {
4-
"version": "v1.0.3"
4+
"version": "v1.1.0"
55
}
66
},
77
"unstable": {

0 commit comments

Comments
 (0)