Need help in checking the dom node position for different screen resoultions
Hi,
We are working on an Open Source Chrome extension: Digital Assistant Client
I am recording the domnode by converting into json by domJson and saving into server. We can find the same recordednode by comparing the json attributes and matching to the original node on the page. We have one problem here when we search for the nodes sometimes we get similar nodes via json which has same property names. In that case we are trying to match the node position that we have recorded. When we try to match the node position in different screen resolutions, it gives us the wrong node. How do we solve this. My code is as given below
// calculate distance between selected node and matching node getDistance: function (node1, node2) {
const x = node1.x - node2.x; const y = node1.y - node2.y; const dist = Math.abs(Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2))); return dist;
},
All Replies (1)
Add-on questions should be posted in the add-ons forum; https://discourse.mozilla-community.org/c/add-ons