Browse Source

Add hamsket.isInViewport to the service API.

pull/3202/head
TheGoddessInari 5 years ago
parent
commit
88880587c6
No known key found for this signature in database
GPG Key ID: 1209B1B7632D69A
  1. 9
      resources/js/hamsket-service-api.js

9
resources/js/hamsket-service-api.js

@ -44,6 +44,15 @@ window.hamsket.parseIntOrZero = function (n) {
return isNaN(result) ? 0 : result;
};
window.hamsket.isInViewport = function(node) {
const rect = node.getBoundingClientRect();
return rect.bottom > 0 &&
rect.right > 0 &&
rect.left < (window.innerWidth || document.documentElement.clientWidth) &&
rect.top < (window.innerHeight || document.documentElement.clientHeight);
};
contextMenu({
window: remote.getCurrentWebContents(),
showCopyImageAddress: true,

Loading…
Cancel
Save