Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

574
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda