Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Haggerto #7

Open
wants to merge 36 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
43bf17e
Added Jest package and test dir
May 28, 2019
a2009a4
Added test script
haggerto May 29, 2019
3b411de
Added test files
haggerto May 29, 2019
c6656fe
Added undo and check tests
May 30, 2019
6f28bfe
Added draw test
nawazu May 30, 2019
011b09e
Added remove test
nawazu May 30, 2019
b9699d4
Added 5 tests total
May 30, 2019
46ad437
Added "moving into check" test
May 31, 2019
e0c20ab
Merge branch 'master' of https://github.com/dongrogers/3D-Hartwig-che…
May 31, 2019
25001f4
Removed board print
May 31, 2019
714944b
add insufficient material, stalemate, threefold repetition
May 31, 2019
6276556
Merge branch 'master' of https://github.com/dongrogers/3D-Hartwig-che…
May 31, 2019
1218ed6
turn tests
Jun 3, 2019
4b8460d
deleted jquery and photon from libraries.js, added both as dependenci…
Jun 3, 2019
c1b99dd
Dependency files
Jun 3, 2019
4f3de36
Updated with test info
Jun 3, 2019
b37dd66
Update README.md
ngorog Jun 3, 2019
f2a7edc
added fen explanation to readme
Jun 3, 2019
dbebc4d
title font change
Jun 3, 2019
c30ae48
formatting
Jun 3, 2019
1685e9d
formatting
Jun 3, 2019
1c82e22
format
Jun 3, 2019
e3331b0
format
Jun 3, 2019
1f094b8
Update README.md
Jun 3, 2019
2e6f936
Update README.md
Jun 3, 2019
74a885a
Update README.md
Jun 3, 2019
6673b47
Update README.md
Jun 3, 2019
8a63c6e
Update README.md
Jun 3, 2019
2555564
Update README.md
Jun 3, 2019
ed7f4d2
Pretty printed the file
ngorog Jun 5, 2019
df39ecb
Unminified
ngorog Jun 5, 2019
5e2714c
Fixed error where pieces in jail could be moved
Jun 9, 2019
5e80b48
Fixed castling issue, only castle towards rooks
ngorog Jun 10, 2019
8dfbb1c
losing focus drops piece
Jun 11, 2019
fe016c3
Merge branch 'master' of https://github.com/dongrogers/3D-Hartwig-che…
Jun 11, 2019
e041e1a
Merge branch 'master' into haggerto
haggerto Jun 11, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
losing focus drops piece
  • Loading branch information
KorsK committed Jun 11, 2019
commit 8dfbb1c5ef31781ccd806b0751142e430841d87a
16 changes: 15 additions & 1 deletion js/scripts.min.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@


function Vector() {}

function Line() {}

function Matrix() {}

var oob = false;

document.getElementById("app").onmouseleave = function(){
oob = true;
};


function checkTouch() {
var a = document.createElement("div");
return a.setAttribute("ontouchmove", "return;"), typeof a.ontouchmove == "function" ? !0 : !1
Expand All @@ -19,11 +28,16 @@ function initControls() {
}

function grabPiece(a) {
!mouseDown && controls && (a.preventDefault(), mouseDown = !0, grabbed = this, grabbedID = grabbed.id.substr(-2), startX = a.pageX - document.body.offsetWidth / 2, startY = a.pageY - document.body.offsetHeight / 2, style = window.getComputedStyle(grabbed), matrix = style.getPropertyValue("-webkit-transform"), matrixParts = matrix.split(","), grabbedW = parseInt(style.getPropertyValue("width")) / 2, grabbedX = parseInt(matrixParts[4]), grabbedY = parseInt(matrixParts[5]), grabbed.classList.add("grabbed"), showMoves(grabbedID), highLight(grabbed, square))
!mouseDown && controls && (a.preventDefault(), mouseDown = !0, grabbed = this, grabbedID = grabbed.id.substr(-2), startX = a.pageX - document.body.offsetWidth / 2, startY = a.pageY - document.body.offsetHeight / 2, style = window.getComputedStyle(grabbed), matrix = style.getPropertyValue("-webkit-transform"), matrixParts = matrix.split(","), grabbedW = parseInt(style.getPropertyValue("width")) / 2, grabbedX = parseInt(matrixParts[4]), grabbedY = parseInt(matrixParts[5]), grabbed.classList.add("grabbed"), showMoves(grabbedID), highLight(grabbed, square))
}

function dragPiece(a) {
if(oob){
dropPiece(a);
oob=false;
}else{
mouseDown && controls && (a.preventDefault(), moveX = a.pageX - document.body.offsetWidth / 2, moveY = a.pageY - document.body.offsetHeight / 2, distX = moveX - startX, distY = moveY - startY, currentColor === "w" ? (newX = grabbedX + distX, newY = grabbedY + distY) : (newX = -(grabbedX + distX), newY = -(grabbedY + distY)), grabbed.style.webkitTransform = "translateX(" + newX + "px) translateY(" + newY + "px) translateZ(2px)", highLight(grabbed, square))
}
}

function dropPiece(a) {
Expand Down