summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2016-05-11 17:38:13 -0400
committerJules Laplace <jules@okfoc.us>2016-05-11 17:38:13 -0400
commit3b70d3a7ce49431f4b8c5b640c720387f3ba1882 (patch)
treed42e6d362bc7d62ebb7e578853ad7eaee4d6edbd /js
parent20ea45d1274b637a604d470d21a3e3c561d5b6e9 (diff)
dont pick same brush twice
Diffstat (limited to 'js')
-rw-r--r--js/ui/nopaint.js6
1 files changed, 3 insertions, 3 deletions
diff --git a/js/ui/nopaint.js b/js/ui/nopaint.js
index 0b3c45f..ecfebd1 100644
--- a/js/ui/nopaint.js
+++ b/js/ui/nopaint.js
@@ -73,17 +73,17 @@ var nopaint = (function(){
nopaint.switch_tool = function(){
last_tool = nopaint.tool
last_tool && last_tool.finish()
- nopaint.tool = nopaint.get_random_tool()
+ nopaint.tool = nopaint.get_random_tool( last_tool )
nopaint.tool.start( last_tool )
console.log("> %s", nopaint.tool.type)
}
nopaint.add_tool = function(fn){
nopaint.tools[fn.type] = fn
}
- nopaint.get_random_tool = function(){
+ nopaint.get_random_tool = function( last_tool ){
var n = rand( nopaint.sum )
for (var i = 0, _len = nopaint.weights.length; i < _len; i++) {
- if (n < nopaint.weights[i]) {
+ if (n < nopaint.weights[i] && nopaint.keys[i] !== last_tool.key) {
return nopaint.tools[ nopaint.keys[i] ]
}
}