From: Jason Woofenden Date: Tue, 1 Nov 2011 03:06:33 +0000 (-0400) Subject: snap to grid so edges line up X-Git-Url: https://jasonwoof.com/gitweb/?p=peach-cgt.git;a=commitdiff_plain;h=3be596d7cfcd16a09505b8c68cad974d7b2901ac;hp=4c75fd3542bb59bc6ece0f46f4ec7b19b16085bf snap to grid so edges line up This is important now that mouse hover makes the card come to the foreground, because it's frustrating when you're pile isn't perfect, and as you go to hover over the front card you hover over one pixel of a lower card, and then it obscures the card you were aiming for. --- diff --git a/client.coffee b/client.coffee index 255d455..99a70a7 100644 --- a/client.coffee +++ b/client.coffee @@ -61,11 +61,10 @@ instantiate_card = (card) -> if card.flipped view.addClass 'flipped' $table.append view - view.draggable containment: '#table' + view.draggable containment: '#table', grid: [20, 20] view.bind 'dragstart', (event, ui) -> view.css 'z-index': card.z = next_card_z() view.bind 'dragstop', (event, ui) -> - #view.css 'z-index': card.z p = view.position() state.move state.agent, card.number, transform_x(p.left), transform_y(p.top) card.view = view diff --git a/server.coffee b/server.coffee index 94672a9..46d48c5 100644 --- a/server.coffee +++ b/server.coffee @@ -185,14 +185,14 @@ test_init = -> timeout 4000, -> test_game.set_cards 'server', [ { text: "Wildabeast 2/2", x: 220, y: 200, owner: 'p2'} - { text: "Wild beast 2/2", x: 350, y: 200, owner: 'p2'} + { text: "Wild beast 2/2", x: 360, y: 200, owner: 'p2'} { text: "Angora bunny 1/1", x: 500, y: 200, owner: 'p2'} - { text: "Ambulatory Cactus 2/1", x: 650, y: 200, owner: 'p2'} + { text: "Ambulatory Cactus 2/1", x: 660, y: 200, owner: 'p2'} { text: "Ent 0/5", x: 800, y: 200, owner: 'p2'} { text: "Carnivore 2/1", x: 220, y: 420, owner: 'p1'} - { text: "Herbivore 1/2", x: 350, y: 420, owner: 'p1'} + { text: "Herbivore 1/2", x: 360, y: 420, owner: 'p1'} { text: "Stone Wall 0/10", x: 500, y: 420, owner: 'p1'} - { text: "Log 0/1", x: 650, y: 420, owner: 'p1'} + { text: "Log 0/1", x: 660, y: 420, owner: 'p1'} { text: "Ent 0/5", x: 800, y: 420, owner: 'p1'} ]