mirror of
https://github.com/rastapasta/mapscii.git
synced 2024-11-25 01:23:58 +01:00
👓 adding zoom step in to config
This commit is contained in:
parent
9dcf71d411
commit
d065fb1849
@ -8,7 +8,8 @@ TermMouse = require('term-mouse')
|
|||||||
|
|
||||||
class Termap
|
class Termap
|
||||||
config:
|
config:
|
||||||
drawOrder: ["admin", "water", "landuse", "building", "road", "housenum_label"]
|
zoomStep: 1
|
||||||
|
drawOrder: ["admin", "water", "landuse", "building", "road", "poi_label", "housenum_label"]
|
||||||
|
|
||||||
icons:
|
icons:
|
||||||
car: "🚗"
|
car: "🚗"
|
||||||
@ -31,12 +32,16 @@ class Termap
|
|||||||
|
|
||||||
layers:
|
layers:
|
||||||
housenum_label:
|
housenum_label:
|
||||||
minZoom: 4
|
minZoom: 3
|
||||||
color: 8
|
color: 8
|
||||||
building:
|
building:
|
||||||
minZoom: 12
|
minZoom: 10
|
||||||
color: 8
|
color: 8
|
||||||
|
|
||||||
|
# poi_label:
|
||||||
|
# minZoom: 3
|
||||||
|
# color: "yellow"
|
||||||
|
|
||||||
road:
|
road:
|
||||||
color: "white"
|
color: "white"
|
||||||
|
|
||||||
@ -101,7 +106,7 @@ class Termap
|
|||||||
|
|
||||||
_onMouseScroll: (event) ->
|
_onMouseScroll: (event) ->
|
||||||
# TODO: handle .x/y for directed zoom
|
# 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()
|
@_draw()
|
||||||
|
|
||||||
_onMouseMove: (event) ->
|
_onMouseMove: (event) ->
|
||||||
@ -121,8 +126,8 @@ class Termap
|
|||||||
when "q"
|
when "q"
|
||||||
process.exit 0
|
process.exit 0
|
||||||
|
|
||||||
when "z" then @zoomBy(.5)
|
when "z" then @zoomBy @config.zoomStep
|
||||||
when "a" then @zoomBy(-.5)
|
when "a" then @zoomBy -@config.zoomStep
|
||||||
when "left" then @view[0] += 5
|
when "left" then @view[0] += 5
|
||||||
when "right" then @view[0] -= 5
|
when "right" then @view[0] -= 5
|
||||||
when "up" then @view[1]+= 5
|
when "up" then @view[1]+= 5
|
||||||
@ -216,7 +221,7 @@ class Termap
|
|||||||
_getFooter: ->
|
_getFooter: ->
|
||||||
"scale: #{Math.floor(@scale*1000)/1000}"
|
"scale: #{Math.floor(@scale*1000)/1000}"
|
||||||
|
|
||||||
notify: ->
|
notify: (text) ->
|
||||||
return if @isDrawing
|
return if @isDrawing
|
||||||
@_write "\r\x1B[K#{@_getFooter()} #{text}"
|
@_write "\r\x1B[K#{@_getFooter()} #{text}"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user