mirror of
https://github.com/rastapasta/mapscii.git
synced 2024-11-21 23:53:08 +01:00
📖 centering of label texts, better text selection
This commit is contained in:
parent
241f9f7ef6
commit
d3e2961184
@ -50,7 +50,10 @@ No web browser around? No worries - discover the planet in your console!
|
||||
* [ ] label drawing
|
||||
* [x] support for point labels
|
||||
* [x] dynamic decluttering of labels
|
||||
* [ ] centering text labels
|
||||
* [x] centering text labels
|
||||
* [ ] multi line label
|
||||
* [ ] label margin to avoid POI overlap?
|
||||
* [ ] translatable raster fonts
|
||||
* [x] filled polygons
|
||||
* [x] convert polygons to triangles
|
||||
* [x] implement fillTriangle into drawille-canvas-blessed-contrib
|
||||
|
@ -9,3 +9,5 @@
|
||||
BlessedCanvas = require 'drawille-canvas-blessed-contrib'
|
||||
|
||||
module.exports = class Canvas extends BlessedCanvas
|
||||
fillText: (text, x, y, size=1) ->
|
||||
super text, x-text.length, y
|
||||
|
@ -1,3 +1,10 @@
|
||||
###
|
||||
termap - Terminal Map Viewer
|
||||
by Michael Strassburger <codepoet@cpan.org>
|
||||
|
||||
methods used all around
|
||||
###
|
||||
|
||||
utils =
|
||||
deg2rad: (angle) ->
|
||||
# (angle / 180) * Math.PI
|
||||
@ -6,9 +13,9 @@ utils =
|
||||
angle / Math.PI * 180
|
||||
|
||||
hex2rgb: (color) ->
|
||||
if not color.match
|
||||
if not color?.match
|
||||
console.log color
|
||||
process.exit()
|
||||
|
||||
return [255, 0, 0] unless color?.match
|
||||
|
||||
unless color.match /^#[a-fA-F0-9]{3,6}$/
|
||||
|
@ -21,12 +21,13 @@ utils = require __dirname+'/src/utils'
|
||||
|
||||
class Termap
|
||||
config:
|
||||
language: 'de'
|
||||
styleFile: __dirname+"/styles/bright.json"
|
||||
|
||||
fillPolygons: true
|
||||
zoomStep: 0.4
|
||||
|
||||
drawOrder: ["admin", "water", "building", "road", "poi_label", "city_label", "housenum_label"]
|
||||
drawOrder: ["admin", "water", "building", "road", "poi_label", "place_label", "housenum_label"]
|
||||
|
||||
icons:
|
||||
car: "🚗"
|
||||
@ -55,6 +56,9 @@ class Termap
|
||||
minZoom: 3.8
|
||||
color: 8
|
||||
|
||||
place_label:
|
||||
color: "yellow"
|
||||
|
||||
poi_label:
|
||||
minZoom: 3
|
||||
color: "yellow"
|
||||
@ -282,7 +286,11 @@ class Termap
|
||||
true
|
||||
|
||||
when "Point"
|
||||
text = feature.properties.house_num or @config.icons[feature.properties.maki] or "◉"
|
||||
text = feature.properties["name_"+@config.language] or
|
||||
feature.properties["name"] or
|
||||
feature.properties.house_num or
|
||||
@config.icons[feature.properties.maki] or
|
||||
"◉"
|
||||
|
||||
wasDrawn = false
|
||||
# TODO: check in definition if points can actually own multiple geometries
|
||||
|
Loading…
Reference in New Issue
Block a user