diff --git a/README.md b/README.md index 61d797b..b4e79b3 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ No web browser around? No worries - discover the planet in your console! ## Behind the scenes ### Libraries #### Mastering the console - * [`x256`](https://github.com/substack/node-x256) for finding nearest xterm-256 [color codes](https://en.wikipedia.org/wiki/File:Xterm_256color_chart.svg) + * [`x256`](https://github.com/substack/node-x256) for converting RGB values to closest xterm-256 [color code](https://en.wikipedia.org/wiki/File:Xterm_256color_chart.svg) * [`term-mouse`](https://github.com/CoderPuppy/term-mouse) for mouse handling * [`keypress`](https://github.com/TooTallNate/keypress) for input handling @@ -55,7 +55,7 @@ No web browser around? No worries - discover the planet in your console! * [x] support for point labels * [x] dynamic decluttering of labels * [x] centering text labels - * [ ] clipping fix when x<0 after repositioning + * [x] clipping fix when x<0 after repositioning * [ ] multi line label * [ ] label margin to avoid POI overlap? * [ ] translatable raster fonts @@ -81,7 +81,6 @@ No web browser around? No worries - discover the planet in your console! * [x] accurate mouse drag&drop * [x] handle console resize * [x] styling -* [ ] turn this into a [`blessed-contrib`](https://github.com/yaronn/blessed-contrib) widget ## License #### The MIT License (MIT) diff --git a/src/Canvas.coffee b/src/Canvas.coffee index ced7bb7..a2d2aa7 100644 --- a/src/Canvas.coffee +++ b/src/Canvas.coffee @@ -2,7 +2,7 @@ termap - Terminal Map Viewer by Michael Strassburger - Simple pixel to barille character mapper + Canvas-like painting abstraction for BrailleBuffer Implementation inspired by node-drawille-canvas (https://github.com/madbence/node-drawille-canvas) * added support for filled polygons diff --git a/src/Renderer.coffee b/src/Renderer.coffee index 220da4a..525766c 100644 --- a/src/Renderer.coffee +++ b/src/Renderer.coffee @@ -41,14 +41,8 @@ module.exports = class Renderer layers: housenum_label: minZoom: 1.5 building: minZoom: 3.8 - - place_label: true poi_label: minZoom: 3 - road: true - water: true - admin: true - isDrawing: false lastDrawAt: 0 @@ -97,10 +91,17 @@ module.exports = class Renderer @notify "rendering #{layer}..." scale = Math.pow 2, @zoom - if @config.layers[layer].minZoom and @zoom > @config.layers[layer].minZoom + if @config.layers[layer]?.minZoom and @zoom > @config.layers[layer].minZoom continue - for feature in @features[layer].tree.search(minX: 0, minY: 0, maxX: 4096, maxY: 4096) + box = + minX: -@view[0]*scale + minY: -@view[1]*scale + maxX: (@width-@view[0])*scale + maxY: (@height-@view[1])*scale + + for feature in @features[layer].tree.search box + #@notify "rendering #{feature.data.id}" @_drawFeature layer, feature.data, scale _drawFeature: (layer, feature, scale) -> diff --git a/src/Termap.coffee b/src/Termap.coffee index e14cd3f..71733f8 100644 --- a/src/Termap.coffee +++ b/src/Termap.coffee @@ -31,7 +31,7 @@ module.exports = class Termap lng: 12.096956 zoom: 2 - view: [0, 0] + view: [0, 100] scale: 4 @@ -66,7 +66,7 @@ module.exports = class Termap _resizeRenderer: (cb) -> @width = (process.stdout.columns-1) >> 1 << 2 - @height = process.stdout.rows >> 2 << 4 + @height = Math.ceil(process.stdout.rows/2) << 4 @renderer.setSize @width, @height