0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-03-15 17:21:17 -05:00

Select images colors and icons with one click

This commit is contained in:
Jesús Espino 2016-12-19 17:58:02 +01:00
parent a9285accad
commit 3279c95a08
3 changed files with 9 additions and 11 deletions

View file

@ -263,12 +263,9 @@
[color selected?]
(let [color-rgb (hex->rgb color)]
(letfn [(toggle-selection [event]
(st/emit! (dc/toggle-color-selection color)))
(toggle-selection-shifted [event]
(when (k/shift? event)
(toggle-selection event)))]
(st/emit! (dc/toggle-color-selection color)))]
[:div.grid-item.small-item.project-th
{:on-click toggle-selection-shifted}
{:on-click toggle-selection}
[:span.color-swatch {:style {:background-color color}}]
[:div.input-checkbox.check-primary
[:input {:type "checkbox"

View file

@ -312,12 +312,15 @@
name (dom/get-value target)]
(st/emit! (di/update-opts :edition false)
(di/rename-icon id name))))
(ignore-click [event]
(dom/stop-propagation event)
(dom/prevent-default event))
(on-edit [event]
(dom/stop-propagation event)
(dom/prevent-default event)
(st/emit! (di/update-opts :edition id)))]
[:div.grid-item.small-item.project-th
{:on-click toggle-selection-shifted
{:on-click toggle-selection
:id (str "grid-item-" id)}
[:div.input-checkbox.check-primary
[:input {:type "checkbox"
@ -328,6 +331,7 @@
[:span.grid-item-image
(icon/icon-svg icon)]
[:div.item-info
{:on-click ignore-click}
(if edition?
[:input.element-name {:type "text"
:auto-focus true

View file

@ -305,9 +305,6 @@
[{:keys [id created-at] :as image} selected? edition?]
(letfn [(toggle-selection [event]
(st/emit! (di/toggle-image-selection id)))
(toggle-selection-shifted [event]
(when (kbd/shift? event)
(toggle-selection event)))
(on-key-down [event]
(when (kbd/enter? event)
(on-blur event)))
@ -321,9 +318,9 @@
(dom/prevent-default event)
(st/emit! (di/update-opts :edition id)))]
[:div.grid-item.images-th
{:on-click toggle-selection-shifted}
[:div.grid-item-th
{:style {:background-image (str "url('" (:thumbnail image) "')")}}
{:on-click toggle-selection
:style {:background-image (str "url('" (:thumbnail image) "')")}}
[:div.input-checkbox.check-primary
[:input {:type "checkbox"
:id (:id image)