diff --git a/app/lib/surface/Camera.coffee b/app/lib/surface/Camera.coffee index b4f90d5fa..7848828e3 100644 --- a/app/lib/surface/Camera.coffee +++ b/app/lib/surface/Camera.coffee @@ -283,8 +283,9 @@ module.exports = class Camera extends CocoClass target = @boundTarget @target, @zoom return if not force and _.isEqual target, @currentTarget @currentTarget = target - @updateViewports target - Backbone.Mediator.publish 'camera:zoom-updated', camera: @, zoom: @zoom, surfaceViewport: @surfaceViewport + viewportDifference = @updateViewports target + if viewportDifference > 0.1 # Roughly 0.1 pixel difference in what we can see + Backbone.Mediator.publish 'camera:zoom-updated', camera: @, zoom: @zoom, surfaceViewport: @surfaceViewport boundTarget: (pos, zoom) -> # Given an {x, y} in Surface coordinates, return one that will keep our viewport on the Surface. @@ -303,6 +304,11 @@ module.exports = class Camera extends CocoClass sv = width: @canvasWidth / @zoom, height: @canvasHeight / @zoom, cx: target.x, cy: target.y sv.x = sv.cx - sv.width / 2 sv.y = sv.cy - sv.height / 2 + if @surfaceViewport + # Calculate how different this viewport is. (If it's basically not different, we can avoid visualizing the update.) + viewportDifference = Math.abs(@surfaceViewport.x - sv.x) + 1.01 * Math.abs(@surfaceViewport.y - sv.y) + 1.02 * Math.abs(@surfaceViewport.width - sv.width) + else + viewportDifference = 9001 @surfaceViewport = sv wv = @surfaceToWorld sv # get x and y @@ -312,6 +318,8 @@ module.exports = class Camera extends CocoClass wv.cy = wv.y + wv.height / 2 @worldViewport = wv + viewportDifference + lock: -> @target = @currentTarget @locked = true diff --git a/app/lib/surface/CoordinateDisplay.coffee b/app/lib/surface/CoordinateDisplay.coffee index 5f4684884..393d3337b 100644 --- a/app/lib/surface/CoordinateDisplay.coffee +++ b/app/lib/surface/CoordinateDisplay.coffee @@ -16,6 +16,7 @@ module.exports = class CoordinateDisplay extends createjs.Container console.error @toString(), 'needs a camera.' unless @camera console.error @toString(), 'needs a layer.' unless @layer @build() + @performShow = @show @show = _.debounce @show, 125 Backbone.Mediator.subscribe(channel, @[func], @) for channel, func of @subscriptions @@ -46,6 +47,7 @@ module.exports = class CoordinateDisplay extends createjs.Container wop.y = Math.round(wop.y) return if wop.x is @lastPos?.x and wop.y is @lastPos?.y @lastPos = wop + @lastScreenPos = x: e.x, y: e.y @hide() @show() # debounced @@ -58,8 +60,11 @@ module.exports = class CoordinateDisplay extends createjs.Container Backbone.Mediator.publish 'surface:coordinate-selected', wop onZoomUpdated: (e) -> - @hide() - @show() + return unless @lastPos + wop = @camera.screenToWorld @lastScreenPos + @lastPos.x = Math.round wop.x + @lastPos.y = Math.round wop.y + @performShow() if @label.parent onFlagColorSelected: (e) -> @placingFlag = Boolean e.color diff --git a/server/commons/Handler.coffee b/server/commons/Handler.coffee index b9a5d6f2e..d3ae3071c 100644 --- a/server/commons/Handler.coffee +++ b/server/commons/Handler.coffee @@ -10,7 +10,7 @@ hipchat = require '../hipchat' deltasLib = require '../../app/lib/deltas' PROJECT = {original: 1, name: 1, version: 1, description: 1, slug: 1, kind: 1, created: 1, permissions: 1} -FETCH_LIMIT = 500 +FETCH_LIMIT = 1000 # So many ThangTypes module.exports = class Handler # subclasses should override these properties