diff options
author | Ulrich-Matthias Schäfer <ulima.ums@googlemail.com> | 2020-04-08 10:08:36 +1000 |
---|---|---|
committer | Ulrich-Matthias Schäfer <ulima.ums@googlemail.com> | 2020-04-08 10:08:36 +1000 |
commit | e4e7e11da50c8129bcf31de03a2849f323aa4299 (patch) | |
tree | 16f9f68a6fefb2116f1e022242ee36943982cb9c /src/types | |
parent | a4a532d5b886d1e59a96cee7453f3b2ffb8f9285 (diff) | |
download | svg.js-e4e7e11da50c8129bcf31de03a2849f323aa4299.tar.gz svg.js-e4e7e11da50c8129bcf31de03a2849f323aa4299.zip |
fix defs and reference, tests for Element
Diffstat (limited to 'src/types')
-rw-r--r-- | src/types/Box.js | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/types/Box.js b/src/types/Box.js index 6d7d8a9..ae0f2cd 100644 --- a/src/types/Box.js +++ b/src/types/Box.js @@ -148,6 +148,16 @@ export function rbox (el) { return box.addOffset() } +// Checks whether the given point is inside the bounding box +export function inside (x, y) { + const box = this.bbox() + + return x > box.x + && y > box.y + && x < box.x + box.width + && y < box.y + box.height +} + registerMethods({ viewbox: { viewbox (x, y, width, height) { |