mirror of
https://github.com/trebonian/visual6502.git
synced 2024-12-22 12:29:20 +00:00
Fixed localx/localy calculation
This commit is contained in:
parent
1fd86334f7
commit
6276d019d7
10
wires.js
10
wires.js
@ -306,19 +306,13 @@ function setChipStyle(props){
|
|||||||
|
|
||||||
function localx(el, gx){
|
function localx(el, gx){
|
||||||
var lx = gx+window.pageXOffset;
|
var lx = gx+window.pageXOffset;
|
||||||
while(el.offsetLeft!=undefined){
|
lx-=el.getBoundingClientRect().left
|
||||||
lx-=el.offsetLeft+el.clientLeft;
|
|
||||||
el = el.parentNode;
|
|
||||||
}
|
|
||||||
return lx;
|
return lx;
|
||||||
}
|
}
|
||||||
|
|
||||||
function localy(el, gy){
|
function localy(el, gy){
|
||||||
var ly = gy+window.pageYOffset;
|
var ly = gy+window.pageYOffset;
|
||||||
while(el.offsetTop!=undefined){
|
ly-=el.getBoundingClientRect().top
|
||||||
ly-=el.offsetTop+el.clientTop;
|
|
||||||
el = el.parentNode;
|
|
||||||
}
|
|
||||||
return ly;
|
return ly;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user