From a2a8e8dd046678816c3797cb894b20abfe84e360 Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Sat, 21 Dec 2024 13:19:48 +0530 Subject: Fix issue with pointer coordinates + Add mouse press/release actions --- src/Chelleport.hs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/Chelleport.hs') diff --git a/src/Chelleport.hs b/src/Chelleport.hs index d00d112..3f78aba 100644 --- a/src/Chelleport.hs +++ b/src/Chelleport.hs @@ -1,11 +1,9 @@ -{-# LANGUAGE MultiParamTypeClasses #-} - module Chelleport where import Chelleport.AppShell (MonadAppShell (hideWindow, showWindow, shutdownApp), setupAppShell) import Chelleport.Context (initializeContext) -import Chelleport.Control (MonadControl (getMousePointerPosition, moveMousePointer, pressMouseButton), directionalIncrement, eventToKeycode, isKeyPressWith, isKeyPressed, isKeyReleaseWith, withShift) -import Chelleport.Draw (MonadDraw, cellSize) +import Chelleport.Control (MonadControl (getMousePointerPosition, mouseButtonDown, mouseButtonUp, moveMousePointer, pressMouseButton), directionalIncrement, eventToKeycode, isKeyPressWith, isKeyPressed, isKeyReleaseWith, withShift) +import Chelleport.Draw (MonadDraw (windowPosition), cellSize) import Chelleport.KeySequence (findMatchPosition, generateGrid, isValidKey, nextChars, toKeyChar) import Chelleport.Types import Chelleport.Utils (intToCInt) @@ -110,7 +108,8 @@ update state (MoveMousePosition (row, col)) = do (wcell, hcell) <- cellSize state let x = (wcell `div` 2) + wcell * intToCInt col let y = (hcell `div` 2) + hcell * intToCInt row - pure (x, y) + (winx, winy) <- windowPosition + pure (winx + x, winy + y) -- Reset entered key sequence and state update state ResetKeys = do -- cgit v1.3.1