Skip to content

Conversation

@swhitty
Copy link
Owner

@swhitty swhitty commented Jun 27, 2024

Any SVG position, size or coordinate can be specified with a unit (absolute or relative). This PR adds support for absolute units that can be explicated converted to pixels using predefined constants.:

  • pixel
  • inch
  • centimeter
  • millimeter
  • point
  • pica
<?xml version="1.0" encoding="utf-8"?>	 
<svg height="10cm" width="10cm" xmlns="http://www.w3.org/2000/svg">
    <rect width="10cm" height="10cm" fill="snow" />
    <polygon points="100,10 40,180 190,60 10,60 160,180" style="fill:lime;stroke:purple;stroke-width:5;fill-rule:evenodd;" />
</svg>

units-cm

@codecov
Copy link

codecov bot commented Jun 27, 2024

Codecov Report

Attention: Patch coverage is 96.15385% with 2 lines in your changes missing coverage. Please review.

Project coverage is 84.18%. Comparing base (b917e2a) to head (57a2676).

Files Patch % Lines
SwiftDraw/DOM.swift 96.42% 1 Missing ⚠️
SwiftDraw/Parser.XML.Scanner.swift 95.83% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #45      +/-   ##
==========================================
+ Coverage   84.07%   84.18%   +0.11%     
==========================================
  Files          77       77              
  Lines        5437     5488      +51     
==========================================
+ Hits         4571     4620      +49     
- Misses        866      868       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@swhitty swhitty merged commit 053e908 into main Jun 27, 2024
@swhitty swhitty deleted the absolute-units branch July 20, 2025 22:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants