From ef6ab82376954f8b094a11b1474dd2954ae8390e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Stra=C3=9Fburger?= Date: Thu, 10 Nov 2016 18:43:35 +0100 Subject: [PATCH] :mouse2: working on mouse projection --- src/Termap.coffee | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Termap.coffee b/src/Termap.coffee index 5a314ff..338e189 100644 --- a/src/Termap.coffee +++ b/src/Termap.coffee @@ -15,7 +15,6 @@ utils = require './utils' config = require './config' module.exports = class Termap - width: null height: null canvas: null @@ -113,8 +112,9 @@ module.exports = class Termap @_draw() _onMouseMove: (event) -> - # only continue if x/y are valid - return unless event.x <= config.output.columns and event.y <= config.output.rows + projected = + x: event.x * 2 + y: event.y * 4 # start dragging if event.button is "left" @@ -130,7 +130,7 @@ module.exports = class Termap @mouseDragging = x: event.x, y: event.y # update internal mouse tracker - @mousePosition = x: event.x, y: event.y + @mousePosition = projected @notify @_getFooter() _onKey: (key) -> @@ -181,7 +181,7 @@ module.exports = class Termap "center: #{utils.digits @center.lat, 3}, #{utils.digits @center.lon, 3} "+ "zoom: #{utils.digits @zoom, 2} "+ - "mouse: #{@mousePosition.x*2-@width/2} #{@mousePosition.y} " + "mouse: #{@mousePosition.x-@width/2} #{@mousePosition.y-@height/2} " notify: (text) -> @_write "\r\x1B[K"+text unless config.headless