1
1
mirror of https://github.com/exyte/Macaw.git synced 2024-09-21 01:47:44 +03:00

Merge pull request #293 from fdelencl42/svgParser_fix

fix 3 style attributes on SVGParser class
This commit is contained in:
Yuri Strot 2018-04-23 16:23:42 +07:00 committed by GitHub
commit 4af9f85804
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 2 deletions

View File

@ -253,6 +253,7 @@
57F1087C1F53CA7E00DC365B /* MDisplayLink_iOS.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57F1087B1F53CA7E00DC365B /* MDisplayLink_iOS.swift */; };
57FCD2771D76EA4600CC0FB6 /* Macaw.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 57FCD26C1D76EA4600CC0FB6 /* Macaw.framework */; };
57FCD27C1D76EA4600CC0FB6 /* MacawTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57FCD27B1D76EA4600CC0FB6 /* MacawTests.swift */; };
602C561D2081C984003AD452 /* rounded.svg in Resources */ = {isa = PBXBuildFile; fileRef = 602C561C2081C984003AD452 /* rounded.svg */; };
5B1FFD7A207E083600716A46 /* SvgContentLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5BAA56A7207C73FF0055BC5B /* SvgContentLayout.swift */; };
5BAA56A8207C73FF0055BC5B /* SvgContentLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5BAA56A7207C73FF0055BC5B /* SvgContentLayout.swift */; };
5BAEA9C9206CEAA20049AAAE /* viewBox.svg in Resources */ = {isa = PBXBuildFile; fileRef = 5BAEA9C8206CEAA20049AAAE /* viewBox.svg */; };
@ -453,6 +454,7 @@
57FCD2761D76EA4600CC0FB6 /* MacawTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = MacawTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
57FCD27B1D76EA4600CC0FB6 /* MacawTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MacawTests.swift; sourceTree = "<group>"; };
57FCD27D1D76EA4600CC0FB6 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
602C561C2081C984003AD452 /* rounded.svg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = rounded.svg; sourceTree = "<group>"; };
5BAA56A7207C73FF0055BC5B /* SvgContentLayout.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SvgContentLayout.swift; sourceTree = "<group>"; };
5BAEA9C8206CEAA20049AAAE /* viewBox.svg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = viewBox.svg; sourceTree = "<group>"; };
5BAEA9CA206CEB7D0049AAAE /* viewBox.reference */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = viewBox.reference; sourceTree = "<group>"; };
@ -563,6 +565,7 @@
57CAB1241D7832E000FD8E47 /* svg */ = {
isa = PBXGroup;
children = (
602C561C2081C984003AD452 /* rounded.svg */,
5BAEA9C8206CEAA20049AAAE /* viewBox.svg */,
C46E83541F94B20E00208037 /* transform.svg */,
C43B064C1F9738EF00787A35 /* clip.svg */,
@ -1092,6 +1095,7 @@
5BAEA9CB206CEB7D0049AAAE /* viewBox.reference in Resources */,
57CAB1311D7832E000FD8E47 /* line.svg in Resources */,
57B7A4DF1EE70D17009D78D7 /* logo.png in Resources */,
602C561D2081C984003AD452 /* rounded.svg in Resources */,
57CAB1321D7832E000FD8E47 /* polygon.svg in Resources */,
57CAB12F1D7832E000FD8E47 /* ellipse.svg in Resources */,
57CAB1341D7832E000FD8E47 /* rect.svg in Resources */,

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 22.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.0" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="30px" height="30px" viewBox="0 0 30 30" enable-background="new 0 0 30 30" xml:space="preserve">
<polyline fill="none" stroke="#000000" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" points="
24.27,6.35 12.54,23.65 5.73,16.59 "/>
</svg>

After

Width:  |  Height:  |  Size: 551 B

View File

@ -632,8 +632,8 @@ open class SVGParser {
let characterSet = NSCharacterSet.decimalDigits.union(NSCharacterSet.punctuationCharacters).inverted
let digitsArray = strokeWidth.components(separatedBy: characterSet)
let digits = digitsArray.joined()
if let value = NumberFormatter().number(from: digits) {
return value.doubleValue
if let value = Double(digits) {
return value
}
}
return 1
@ -643,6 +643,8 @@ open class SVGParser {
var cap = LineCap.butt
if let strokeCap = styleParts["stroke-linecap"] {
switch strokeCap {
case "round":
cap = .round
case "butt":
cap = .butt
case "square":
@ -658,6 +660,8 @@ open class SVGParser {
var join = LineJoin.miter
if let strokeJoin = styleParts["stroke-linejoin"] {
switch strokeJoin {
case "round":
join = .round
case "miter":
join = .miter
case "bevel":