Skip to content

Commit

Permalink
limit url updates to after the slider stops moving
Browse files Browse the repository at this point in the history
  • Loading branch information
imathis committed Apr 30, 2013
1 parent c7a40aa commit d4de64e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
2 changes: 2 additions & 0 deletions assets/javascripts/lib/dragdealer.js
Expand Up @@ -262,6 +262,8 @@ Dragdealer.prototype =
{
this.stopDrag();
this.stopTap();
$(this.handle).trigger('dang');
//console.log('dang')
//this.cancelEvent(e);
},
documentResizeHandler: function(e)
Expand Down
15 changes: 7 additions & 8 deletions assets/javascripts/modules/site.coffee
Expand Up @@ -24,14 +24,14 @@ site = Backbone.View.extend
events:
'click .url' : 'selectUrl'
'click .show-more' : 'toggleWhy'
'dang .handle' : 'setUrl'

updateColor: ->
color = @model.hsla()
tile = @model.get 'tile'
opt = {}
opt[tile] = color
@model.set opt
@setUrl()
@setPageStyles() if tile is 'foreground'

selectUrl: (e)->
Expand Down Expand Up @@ -64,14 +64,13 @@ site = Backbone.View.extend
hash = @getColorUrl @model.get 'foreground'
background = @model.get 'background'
hash += "/#{@getColorUrl background}" if background[3] > 0

input=$('.url')
url = "#{host}/#{hash}"
update = @throttle ((h)-> window.location.replace(h)), 300
update(hash)
width = url.length*7.8
input.css width: width
input.val(url)
unless url is (window.location.host + '/' + window.location.hash)
input=$('.url')
window.location.replace(hash)
width = url.length*7.8
input.css width: width
input.val(url)

getColorUrl: (color)->
frag = @model.hslToHex color
Expand Down

0 comments on commit d4de64e

Please sign in to comment.