🎉 Zoom lense tool

This commit is contained in:
Pablo Alba 2023-01-17 17:54:35 +01:00 committed by Alejandro Alonso
parent a8c0d437ce
commit c25cf043fa
10 changed files with 103 additions and 42 deletions

View file

@ -6,13 +6,19 @@
(ns app.util.keyboard
(:require
[app.config :as cfg]))
[app.config :as cfg]
[cuerdas.core :as str]))
(defn is-key?
[^string key]
(fn [^js e]
(= (.-key e) key)))
(defn is-key-ignore-case?
[^string key]
(fn [^js e]
(= (str/upper (.-key e)) (str/upper key))))
(defn ^boolean alt?
[^js event]
(.-altKey event))
@ -38,6 +44,7 @@
(def esc? (is-key? "Escape"))
(def enter? (is-key? "Enter"))
(def space? (is-key? " "))
(def z? (is-key-ignore-case? "z"))
(def up-arrow? (is-key? "ArrowUp"))
(def down-arrow? (is-key? "ArrowDown"))
(def left-arrow? (is-key? "ArrowLeft"))