HTML and CSS Reference
In-Depth Information
return
return newBoard ;
}
function
function eventMouseUp ( event ) {
var
var mouseX ;
var
var mouseY ;
var
var pieceX ;
var
var pieceY ;
var
var x ;
var
var y ;
iif ( event . pageX || event . pageY ) {
x = event . pageX ;
y = event . pageY ;
} else
else {
x = e . clientX + document . body . scrollLeft +
document . documentElement . scrollLeft ;
y = e . clientY + document . body . scrollTop +
document . documentElement . scrollTop ;
}
x -= theCanvas . offsetLeft ;
y -= theCanvas . offsetTop ;
mouseX = x ;
mouseY = y ;
var
var selectedList = new
new Array ();
for
for ( var
var c = 0 ; c < cols ; c ++ ) {
for
for ( var
var r = 0 ; r < rows ; r ++ ) {
pieceX = c * partWidth + c * xPad + startXOffset ;
pieceY = r * partHeight + r * yPad + startYOffset ;
iif ( ( mouseY >= pieceY ) && ( mouseY <= pieceY + partHeight ) &&
( mouseX >= pieceX ) && ( mouseX <= pieceX + partWidth ) ) {
iif ( board [ c ][ r ]. selected ) {
board [ c ][ r ]. selected = false
false ;
} else
else {
board [ c ][ r ]. selected = true
true ;
}
}
iif ( board [ c ][ r ]. selected ) {
selectedList . push ({ col : c , row : r })
}
Search WWH ::




Custom Search