Skip to content

Commit

Permalink
grab me
Browse files Browse the repository at this point in the history
  • Loading branch information
chee committed May 21, 2018
1 parent 0a807dd commit 2ed35c9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions client/index.js
Expand Up @@ -104,6 +104,7 @@ const starting = {}

const handleDown = event => {
if (!event.target.classList.contains(pieceClass)) return
document.body.classList.add('grabbing')

element = event.target
dragging = true
Expand Down Expand Up @@ -143,6 +144,8 @@ function getDistance ({x: x1, y: y1}, {x: x2, y: y2}) {

const handleUp = event => {
if (held) return
document.body.classList.remove('add')

const {id} = element
const {x, y, z} = positions[id]

Expand Down Expand Up @@ -176,6 +179,7 @@ const handleClick = event => {
element.classList.remove('held')
element = null
held = false
document.body.classList.remove('grabbing')
return
}

Expand All @@ -185,6 +189,7 @@ const handleClick = event => {

dragging = false
held = true
document.body.classList.add('grabbing')

element = event.target

Expand Down
4 changes: 4 additions & 0 deletions client/index.sass
Expand Up @@ -91,6 +91,10 @@ html, body
color: white
height: 100%
width: 100%
cursor: grab

.grabbing
cursor: grabbing

.gay
background: repeating-linear-gradient(45deg, #ff2a50, #ffaa20 10px, #eeee33 10px, #33cc99 20px, #3399ff 20px, #cc55cc 30px)
Expand Down

0 comments on commit 2ed35c9

Please sign in to comment.