1
1
mirror of https://github.com/exyte/Macaw.git synced 2024-08-16 00:20:23 +03:00

SVGParser will parse the class attribute as Node Tag.

This commit is contained in:
ty0x2333 2022-03-08 05:05:10 +08:00
parent d508348111
commit 01fadbb828

View File

@ -897,8 +897,15 @@ open class SVGParser {
}
fileprivate func getTag(_ element: XMLHash.XMLElement) -> [String] {
let id = element.allAttributes["id"]?.text
return id.map { [$0] } ?? []
var result: [String] = []
if let id = element.allAttributes["id"]?.text {
result.append(id)
}
if let classes = element.allAttributes["class"]?.text.split(separator: " ").map({ String($0) }) {
result.append(contentsOf: classes)
}
return Array(Set(result))
}
fileprivate func getOpacity(_ styleParts: [String: String]) -> Double {