From e4e7e11da50c8129bcf31de03a2849f323aa4299 Mon Sep 17 00:00:00 2001 From: Ulrich-Matthias Schäfer Date: Wed, 8 Apr 2020 10:08:36 +1000 Subject: fix defs and reference, tests for Element --- src/types/Box.js | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/types') 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) { -- cgit v1.2.3