diff --git a/src/BrailleBuffer.coffee b/src/BrailleBuffer.coffee index 00f955e..1c8f27f 100644 --- a/src/BrailleBuffer.coffee +++ b/src/BrailleBuffer.coffee @@ -22,6 +22,8 @@ module.exports = class BrailleBuffer foregroundBuffer: null backgroundBuffer: null + globalBackground: null + termReset: "\x1B[39;49m" constructor: (@width, @height) -> @@ -34,6 +36,8 @@ module.exports = class BrailleBuffer @foregroundBuffer = [] @backgroundBuffer = [] + setGlobalBackground: (@globalBackground) -> + setBackground: (x, y, color) -> return unless 0 <= x < @width and 0 <= y < @height idx = @_project x, y @@ -58,6 +62,7 @@ module.exports = class BrailleBuffer cb idx, mask _termColor: (foreground, background) -> + background = background or @globalBackground if foreground and background "\x1B[38;5;#{foreground};48;5;#{background}m" else if foreground diff --git a/src/Canvas.coffee b/src/Canvas.coffee index b5cbea8..c022843 100644 --- a/src/Canvas.coffee +++ b/src/Canvas.coffee @@ -50,6 +50,9 @@ module.exports = class Canvas bresenham projected[i-1]..., projected[i]..., (x, y) => @buffer.setPixel x, y, color + setBackground: (color) -> + @buffer.setGlobalBackground color + background: (x, y, color) -> point = @_project x, y @buffer.setBackground point[0], point[1], color @@ -62,7 +65,7 @@ module.exports = class Canvas point = @_project point[0], point[1] point[0] = utils.clamp point[0], 0, @width point[1] = utils.clamp point[1], 0, @height - + if point[0] isnt lastPoint[0] or point[1] isnt lastPoint[1] vertices = vertices.concat point[0], point[1] lastPoint = point diff --git a/src/Renderer.coffee b/src/Renderer.coffee index f3db953..6045ff1 100644 --- a/src/Renderer.coffee +++ b/src/Renderer.coffee @@ -85,10 +85,9 @@ module.exports = class Renderer @labelBuffer.clear() # TODO: better way for background color instead of setting filling FG? - # if color = @styler.styleById['background']?.paint['background-color'] - # @canvas.strokeStyle = x256 utils.hex2rgb(color)... - # @canvas.fillRect 0, 0, @width, @height - # else + if color = @styler.styleById['background']?.paint['background-color'] + @canvas.setBackground x256 utils.hex2rgb color + @canvas.clear() @canvas.reset() diff --git a/src/Termap.coffee b/src/Termap.coffee index d4cd041..99a6e39 100644 --- a/src/Termap.coffee +++ b/src/Termap.coffee @@ -15,7 +15,7 @@ utils = require './utils' module.exports = class Termap config: - styleFile: __dirname+"/../styles/bright.json" + styleFile: __dirname+"/../styles/basic.json" zoomStep: 0.4 width: null diff --git a/styles/bright.json b/styles/bright.json index 16cdde7..09ec750 100644 --- a/styles/bright.json +++ b/styles/bright.json @@ -1158,14 +1158,6 @@ }, "source-layer": "housenum_label" }, - { - "type": "symbol", - "id": "water_label", - "paint": { - "text-color": "#333" - }, - "source-layer": "housenum_label" - }, { "type": "symbol", "id": "place_label_other",