0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-07 14:58:38 -05:00

Add colorpicker styles and minor changes.

This commit is contained in:
Andrey Antukh 2015-12-22 10:19:04 +02:00
parent 5fb93ad5fd
commit 5cea9f1a36
3 changed files with 16 additions and 10 deletions

View file

@ -16,10 +16,8 @@
(let [canvas (util/get-ref-dom own "colorpicker")
context (.getContext canvas "2d")
brect (.getBoundingClientRect canvas)
ox (.-left brect)
oy (.-top brect)
x (- (.-pageX e) ox)
y (- (.-pageY e) oy)
x (- (.-pageX e) (.-left brect))
y (- (.-pageY e) (.-top brect))
image (.getImageData context x y 1 1)
r (aget (.-data image) 0)
g (aget (.-data image) 1)
@ -30,12 +28,13 @@
(defn colorpicker-render
[own callback]
(html
[:canvas
{:width "400"
:height "300"
:on-click #(on-click-handler % own callback)
:id "colorpicker"
:ref "colorpicker"}]))
[:section.colorpicker
[:canvas
{:width "400"
:height "300"
:on-click #(on-click-handler % own callback)
:id "colorpicker"
:ref "colorpicker"}]]))
(defn colorpicker-did-mount
[own]

View file

@ -43,3 +43,4 @@
@import 'partials/library-bar';
@import 'partials/lightbox';
@import 'partials/color-palette';
@import 'partials/colorpicker';

View file

@ -0,0 +1,6 @@
.colorpicker {
canvas {
border: 1px solid #111111;
cursor: cell;
}
}