mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-04 14:24:53 +08:00
[flutter] Fixes #2546, fix drawing before controller initialized drawable
This commit is contained in:
parent
ac4ff96915
commit
c0efb545bd
@ -1,3 +1,6 @@
|
||||
# 4.2.27
|
||||
- Fixes clipping in case of colinear clipping edges.
|
||||
|
||||
# 4.2.26
|
||||
- `Skeleton.getBounds()` takes clipping into consideration.
|
||||
|
||||
|
||||
@ -37,8 +37,12 @@ class SimpleAnimation extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
reportLeaks();
|
||||
final controller = SpineWidgetController(onInitialized: (controller) {
|
||||
// Set the walk animation on track 0, let it loop
|
||||
controller.animationState.setAnimationByName(0, "walk", true);
|
||||
// Set the default mixing time between animations
|
||||
controller.animationState.getData().setDefaultMix(0.2);
|
||||
// Set the portal animation on track 0
|
||||
controller.animationState.setAnimationByName(0, "portal", true);
|
||||
// Queue the run animation after the portal animation
|
||||
controller.animationState.addAnimationByName(0, "run", true, 0);
|
||||
});
|
||||
|
||||
return Scaffold(
|
||||
|
||||
Binary file not shown.
@ -483,6 +483,7 @@ class _SpineRenderObject extends RenderBox {
|
||||
Bounds _bounds;
|
||||
bool _sizedByBounds;
|
||||
bool _disposed = false;
|
||||
bool _firstUpdated = false;
|
||||
|
||||
_SpineRenderObject(this._skeletonDrawable, this._controller, this._fit, this._alignment, this._bounds, this._sizedByBounds);
|
||||
|
||||
@ -618,6 +619,7 @@ class _SpineRenderObject extends RenderBox {
|
||||
markNeedsPaint();
|
||||
_scheduleFrame();
|
||||
}
|
||||
_firstUpdated = true;
|
||||
}
|
||||
|
||||
void _setCanvasTransform(Canvas canvas, Offset offset) {
|
||||
@ -669,9 +671,11 @@ class _SpineRenderObject extends RenderBox {
|
||||
canvas.save();
|
||||
_setCanvasTransform(canvas, offset);
|
||||
|
||||
_controller.onBeforePaint?.call(_controller, canvas);
|
||||
final commands = _skeletonDrawable.renderToCanvas(canvas);
|
||||
_controller.onAfterPaint?.call(_controller, canvas, commands);
|
||||
if (_firstUpdated) {
|
||||
_controller.onBeforePaint?.call(_controller, canvas);
|
||||
final commands = _skeletonDrawable.renderToCanvas(canvas);
|
||||
_controller.onAfterPaint?.call(_controller, canvas, commands);
|
||||
}
|
||||
|
||||
canvas.restore();
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
name: spine_flutter
|
||||
description: The official Spine Flutter Runtime to load, display and interact with Spine animations.
|
||||
version: 4.2.26
|
||||
version: 4.2.27
|
||||
homepage: https://esotericsoftware.com
|
||||
repository: https://github.com/esotericsoftware/spine-runtimes
|
||||
issue_tracker: https://github.com/esotericsoftware/spine-runtimes/issues
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user