mirror of
https://github.com/rastapasta/mapscii.git
synced 2025-02-16 09:29:13 +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
|
* [ ] label drawing
|
||||||
* [x] support for point labels
|
* [x] support for point labels
|
||||||
* [x] dynamic decluttering of 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] filled polygons
|
||||||
* [x] convert polygons to triangles
|
* [x] convert polygons to triangles
|
||||||
* [x] implement fillTriangle into drawille-canvas-blessed-contrib
|
* [x] implement fillTriangle into drawille-canvas-blessed-contrib
|
||||||
|
@ -9,3 +9,5 @@
|
|||||||
BlessedCanvas = require 'drawille-canvas-blessed-contrib'
|
BlessedCanvas = require 'drawille-canvas-blessed-contrib'
|
||||||
|
|
||||||
module.exports = class Canvas extends BlessedCanvas
|
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 =
|
utils =
|
||||||
deg2rad: (angle) ->
|
deg2rad: (angle) ->
|
||||||
# (angle / 180) * Math.PI
|
# (angle / 180) * Math.PI
|
||||||
@ -6,9 +13,9 @@ utils =
|
|||||||
angle / Math.PI * 180
|
angle / Math.PI * 180
|
||||||
|
|
||||||
hex2rgb: (color) ->
|
hex2rgb: (color) ->
|
||||||
if not color.match
|
if not color?.match
|
||||||
console.log color
|
console.log color
|
||||||
process.exit()
|
|
||||||
return [255, 0, 0] unless color?.match
|
return [255, 0, 0] unless color?.match
|
||||||
|
|
||||||
unless color.match /^#[a-fA-F0-9]{3,6}$/
|
unless color.match /^#[a-fA-F0-9]{3,6}$/
|
||||||
|
@ -21,12 +21,13 @@ utils = require __dirname+'/src/utils'
|
|||||||
|
|
||||||
class Termap
|
class Termap
|
||||||
config:
|
config:
|
||||||
|
language: 'de'
|
||||||
styleFile: __dirname+"/styles/bright.json"
|
styleFile: __dirname+"/styles/bright.json"
|
||||||
|
|
||||||
fillPolygons: true
|
fillPolygons: true
|
||||||
zoomStep: 0.4
|
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:
|
icons:
|
||||||
car: "🚗"
|
car: "🚗"
|
||||||
@ -55,6 +56,9 @@ class Termap
|
|||||||
minZoom: 3.8
|
minZoom: 3.8
|
||||||
color: 8
|
color: 8
|
||||||
|
|
||||||
|
place_label:
|
||||||
|
color: "yellow"
|
||||||
|
|
||||||
poi_label:
|
poi_label:
|
||||||
minZoom: 3
|
minZoom: 3
|
||||||
color: "yellow"
|
color: "yellow"
|
||||||
@ -282,7 +286,11 @@ class Termap
|
|||||||
true
|
true
|
||||||
|
|
||||||
when "Point"
|
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
|
wasDrawn = false
|
||||||
# TODO: check in definition if points can actually own multiple geometries
|
# TODO: check in definition if points can actually own multiple geometries
|
||||||
|
Loading…
Reference in New Issue
Block a user