Skip to content

Conversation

@f3dm76
Copy link
Collaborator

@f3dm76 f3dm76 commented Feb 7, 2019

No description provided.

Update Pattern model

Fix

Cherry pick

Last cherry pick

Fix

Merge fixes
ctx!.setFillColor(color.toCG())
} else if let gradient = fill as? Gradient {
drawGradient(gradient, ctx: ctx, opacity: opacity)
} else if let pattern = fill as? Pattern {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not related to this PR (recommendation only), maybe we should convert this (in another similar place too) if constructions with many cases to appropriate switch cycle?

switch fill { case let gradient = fill as? Gradient: }

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I honestly don't see why switch would be better in this case (I think of it as a thingy for enums only), but I can do it, since I don't care very much

if let polyline = parsePolyline(node) {
let mask = try getMask(style, locus: polyline)
return Shape(form: polyline, fill: getFillColor(style, groupStyle: style), stroke: getStroke(style, groupStyle: style), place: position, opacity: getOpacity(style), clip: getClipPath(style, locus: polyline), mask: mask, tag: getTag(element))
return Shape(form: polyline, fill: getFillColor(style, groupStyle: style, locus: polyline), stroke: getStroke(style, groupStyle: style), place: position, opacity: getOpacity(style), clip: getClipPath(style, locus: polyline), mask: mask, tag: getTag(element))
Copy link
Contributor

@amarunko amarunko Feb 7, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recommendation comment. We can add to swiftlint rule for 120-130 character string. Long strings not readable, especially in GitHub web version.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not only are they unreadable - they are unmergable. And the problem is not the length of the line per se, but the pure quantity of arguments. Not much can be done about that, since I don't think splitting each of them into 15 lines will help anything

return
}
if !pattern.userSpace {
BoundsUtils.applyTransformToNodeInRespectiveCoords(respectiveNode: pattern.content, absoluteLocus: shape.form)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line looks like a bug for me. You're modifying pattern during rendering. We should never change user model. Moreover these changes will accumulate, so pattern.content should be incorrect after several draws.

for groupNode in patternGroup.contents {
applyTransformToNodeInRespectiveCoords(respectiveNode: groupNode, absoluteLocus: absoluteLocus)
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if respectiveNode is not a Shape and not a Group? Is it normal case? Or should we throw an exception for this?

@ystrot ystrot added this to the 0.9.4 milestone Feb 12, 2019
@ystrot ystrot self-assigned this Feb 12, 2019
@ystrot ystrot merged commit 95a01d8 into exyte:master Feb 12, 2019
@f3dm76 f3dm76 deleted the task/pattern-fill branch April 8, 2019 10:00
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.

3 participants