From d065fb1849959eaaaa09845281497b513917724c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Stra=C3=9Fburger?= Date: Sun, 18 Sep 2016 21:50:09 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=93=20adding=20zoom=20step=20in=20to?= =?UTF-8?q?=20config?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- termap.coffee | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/termap.coffee b/termap.coffee index 8a29f02..9732768 100644 --- a/termap.coffee +++ b/termap.coffee @@ -8,7 +8,8 @@ TermMouse = require('term-mouse') class Termap config: - drawOrder: ["admin", "water", "landuse", "building", "road", "housenum_label"] + zoomStep: 1 + drawOrder: ["admin", "water", "landuse", "building", "road", "poi_label", "housenum_label"] icons: car: "🚗" @@ -31,12 +32,16 @@ class Termap layers: housenum_label: - minZoom: 4 + minZoom: 3 color: 8 building: - minZoom: 12 + minZoom: 10 color: 8 + # poi_label: + # minZoom: 3 + # color: "yellow" + road: color: "white" @@ -101,7 +106,7 @@ class Termap _onMouseScroll: (event) -> # TODO: handle .x/y for directed zoom - @zoomBy .5 * if event.button is "up" then 1 else -1 + @zoomBy @config.zoomStep * if event.button is "up" then 1 else -1 @_draw() _onMouseMove: (event) -> @@ -121,8 +126,8 @@ class Termap when "q" process.exit 0 - when "z" then @zoomBy(.5) - when "a" then @zoomBy(-.5) + when "z" then @zoomBy @config.zoomStep + when "a" then @zoomBy -@config.zoomStep when "left" then @view[0] += 5 when "right" then @view[0] -= 5 when "up" then @view[1]+= 5 @@ -216,7 +221,7 @@ class Termap _getFooter: -> "scale: #{Math.floor(@scale*1000)/1000}" - notify: -> + notify: (text) -> return if @isDrawing @_write "\r\x1B[K#{@_getFooter()} #{text}"