mirror of
https://github.com/trebonian/visual6502.git
synced 2024-12-21 21:29:16 +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){
|
||||
var lx = gx+window.pageXOffset;
|
||||
while(el.offsetLeft!=undefined){
|
||||
lx-=el.offsetLeft+el.clientLeft;
|
||||
el = el.parentNode;
|
||||
}
|
||||
lx-=el.getBoundingClientRect().left
|
||||
return lx;
|
||||
}
|
||||
|
||||
function localy(el, gy){
|
||||
var ly = gy+window.pageYOffset;
|
||||
while(el.offsetTop!=undefined){
|
||||
ly-=el.offsetTop+el.clientTop;
|
||||
el = el.parentNode;
|
||||
}
|
||||
ly-=el.getBoundingClientRect().top
|
||||
return ly;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user