mirror of
https://github.com/rastapasta/mapscii.git
synced 2024-11-25 01:23:58 +01:00
🎨 moving poiMarker to config, improving asciiMap
This commit is contained in:
parent
7e255edc53
commit
7edde3b30f
@ -18,14 +18,15 @@ utils = require './utils'
|
||||
module.exports = class BrailleBuffer
|
||||
brailleMap: [[0x1, 0x8],[0x2, 0x10],[0x4, 0x20],[0x40, 0x80]]
|
||||
asciiMap:
|
||||
#"▬": [2+32, 4+64]
|
||||
# "▬": [2+32, 4+64]
|
||||
# "▌": [1+2+4+8]
|
||||
# "▐": [16+32+64+128]
|
||||
#"¯": [1+16]
|
||||
"▀": [1+2+16+32]
|
||||
"▄": [4+8+64+128]
|
||||
"■": [2+4+32+64]
|
||||
#"▓": [1+4+32+128, 2+8+16+64]
|
||||
"█": [255]
|
||||
#"▓": [1+4+32+128, 2+8+16+64]
|
||||
|
||||
pixelBuffer: null
|
||||
charBuffer: null
|
||||
@ -86,15 +87,14 @@ module.exports = class BrailleBuffer
|
||||
continue unless bits instanceof Array
|
||||
masks.push mask: mask, char: char for mask in bits
|
||||
|
||||
reducer = (best, mask) ->
|
||||
covered = utils.population(mask.mask&i)
|
||||
return if not best or best.covered < covered
|
||||
char: mask.char, covered: covered
|
||||
else
|
||||
best
|
||||
|
||||
for i in [1..255]
|
||||
@asciiToBraille[i] = masks.reduce(reducer, undefined).char
|
||||
@asciiToBraille[i] = masks.reduce(((best, mask) ->
|
||||
covered = utils.population mask.mask&i
|
||||
if not best or best.covered < covered
|
||||
char: mask.char, covered: covered
|
||||
else
|
||||
best
|
||||
), undefined).char
|
||||
|
||||
_termColor: (foreground, background) ->
|
||||
background = background or @globalBackground
|
||||
|
@ -175,9 +175,8 @@ module.exports = class Renderer
|
||||
@canvas.polygon points, feature.color
|
||||
|
||||
when "symbol"
|
||||
genericSymbol = null
|
||||
text = feature.label or
|
||||
genericSymbol = "◉"
|
||||
genericSymbol = config.poiMarker
|
||||
|
||||
return false if @_seen[text] and not genericSymbol
|
||||
|
||||
@ -192,8 +191,8 @@ module.exports = class Renderer
|
||||
break
|
||||
|
||||
else if config.layers[feature.layer]?.cluster and
|
||||
@labelBuffer.writeIfPossible "◉", point.x, point.y, feature, 3
|
||||
@canvas.text "◉", point.x, point.y, feature.color
|
||||
@labelBuffer.writeIfPossible config.poiMarker, point.x, point.y, feature, 3
|
||||
@canvas.text config.poiMarker, point.x, point.y, feature.color
|
||||
placed = true
|
||||
break
|
||||
|
||||
|
@ -37,3 +37,5 @@ module.exports =
|
||||
headless: false
|
||||
|
||||
delimeter: "\n\r"
|
||||
|
||||
poiMarker: "◉"
|
Loading…
Reference in New Issue
Block a user