Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

573
Views
Check whether an SVG rect is within an SVG path

I am trying to figure out how to check if a rectangle is fully within an SVG path. Currently I am using SVGs isPointInFill() function to check if its corner points do so. But as you see, the pink square is visually not within the SVG path – but its corner points are, so it is labeled as "inside".

I need something like getIntersectionList() but for two SVGelements.

Does anyone knows a way to figure this out?

enter image description here

Edit: I found a solution. Instead of Rect elements, I used Path elements. For paths I have .getTotalLength() and .getPointAtLength() – thats how I can get coords of the whole outline for each px.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Brute force method - clone that SVG element, fill the path with black (and draw it last). Dump the resulting SVG into Canvas, if any pixels aren't white or black, check to see if they're the color of one of the rects.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!