Repository navigation
fix(draw): make draw_start, draw_offset and svg path morph reach the frame - #444
Merged
Merged
Conversation
…frame Six items from #431, five of them a declared property that rendered nothing. draw_start was ignored on an svg whose stroke was finished or static: the progress >= 1.0 branch delegated straight to resvg and never consulted it. svg now folds draw_start, draw_progress and draw_offset into one window, and takes the resvg shortcut only when that window is the whole path -- so a finished stroke can be permanently trimmed from its tail by the same segment extraction used mid-reveal. arrow and connector never read props.draw_start at all, and shape resolved only its own static field, ignoring keyframes. Both now trim through trim_path_between. The same change fixes the 8x8 dot they painted at draw_progress 0. Its cause is the one line.rs already solved: a dash of [draw_len, total_len - draw_len + 0.01] with draw_len = 0 and a round cap paints a solid dot of diameter width. They copy line.rs's PathMeasure extraction now, and return without painting on an empty window. draw_offset is a new AnimatedProperties field that shifts both ends of the reveal window, each clamped to [0, 1] -- a comet that marches and shrinks at the far end rather than wrapping. It is not wired into line, which was read-only for this work. Keyframes on d could not go through the generic animation system: KeyframeValue is Number or Color, so a path string cannot round-trip through it, and adding "d" to KNOWN_MOTION_PROPERTIES would have been exactly the accepted-but-inert field this repository keeps closing. svg.path_morph mirrors shape.path_morph instead, with target naming an element id since a document usually holds more than one path. A morph between paths of different command structure is refused at validate rather than resampled. Resampling arbitrary SVG topologies is a large, silently-ugly piece of work, and the repository's taste is the named refusal -- the draw: true rejection is the direct precedent. The check reuses interpolate_path_data's own mismatch detection rather than reimplementing it. Closes #431
12 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #431. Part of #438.
Six items, five of them a declared property that rendered nothing.
draw_starton a finished stroke. Ignored on ansvgwhose stroke wasfinished or static: the
progress >= 1.0branch delegated straight to resvg andnever consulted it.
svgnow foldsdraw_start,draw_progressand the newdraw_offsetinto one window, and takes the resvg shortcut only when that windowis the whole path — so a finished stroke can be permanently trimmed from its tail
by the same segment extraction used mid-reveal, with the cap, join and width it
already had.
arrow,connector,shape. The first two never readprops.draw_startatall;
shaperesolved only its own static field and ignored keyframes. All threego through
trim_path_betweennow.The 8×8 dot at
draw_progress: 0. Same fix, same causeline.rsalreadysolved: a dash of
[draw_len, total_len - draw_len + 0.01]withdraw_len = 0and a hardcoded round cap paints a solid dot of diameter
width.arrowandconnectorcopyline'sPathMeasureextraction and return without painting onan empty window.
draw_offset. A newAnimatedPropertiesfield shifting both ends of thereveal window, each clamped to
[0, 1]— a comet that marches and shrinks at thefar end rather than wrapping, since
trim_path_betweenhas no two-segment model.Animatable by
keyframesandwiggle.dkeyframes withtarget. These could not go through the generic animationsystem:
KeyframeValueisNumber | Color, so a path string cannot round-tripthrough it, and adding
"d"toKNOWN_MOTION_PROPERTIESwould have been exactlythe accepted-but-inert field this repository keeps closing.
svg.path_morphmirrors
shape.path_morphinstead, withtargetnaming an element id because adocument usually holds more than one path. An unmatched target falls back to the
untouched document rather than blanking the frame.
Structure mismatch: refused, not resampled. Resampling arbitrary SVG
topologies is a large piece of work that produces silently ugly interpolations,
and the repository's taste is the named refusal — the
draw: truerejection isthe direct precedent. The check reuses
interpolate_path_data's own mismatchdetection rather than reimplementing path math.
Known gaps, stated rather than left to be found
draw_offsethas no effect online.line.rswas read-only for this work— it is the module the others were imitating. Wiring it in is a follow-up.
path_morph.targetmatching is a substring scan forid="…", in both therender-time patcher and the validator. Enough for a plain
<path id="…">, andit would miss a namespaced attribute or unusual whitespace. A real fix parses
with
usvg/roxmltreeat both ends.Tests
Render tests with pixel assertions throughout — every item reverted individually
and watched go red:
cargo test -p rustmotion --lib cli::commands::validate_schema47 passed. Clippyand the full suite run at integration; a sibling workstream is still mid-flight.