mirror of
https://github.com/flame-engine/flame.git
synced 2025-11-01 19:12:31 +08:00
Fixing center repaint
This commit is contained in:
@ -67,11 +67,12 @@ void main() async {
|
||||
dashbook.storiesOf('FlameSpriteWidget').decorator(CenterDecorator()).add(
|
||||
'default',
|
||||
(ctx) => Container(
|
||||
width: ctx.numberProperty('container width', 200),
|
||||
width: ctx.numberProperty('container width', 400),
|
||||
height: ctx.numberProperty('container height', 200),
|
||||
padding: const EdgeInsets.all(20),
|
||||
child: FlameSpriteWidget(
|
||||
sprite: shieldSprite,
|
||||
center: ctx.boolProperty('center', true),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@ -11,7 +11,7 @@ dependencies:
|
||||
sdk: flutter
|
||||
flame:
|
||||
path: ../../../
|
||||
dashbook: ^0.0.4
|
||||
dashbook: ^0.0.5
|
||||
|
||||
cupertino_icons: ^0.1.2
|
||||
flutter:
|
||||
|
||||
@ -28,7 +28,7 @@ class _FlameSpritePainer extends CustomPainter {
|
||||
_FlameSpritePainer(this._sprite, this._center);
|
||||
|
||||
@override
|
||||
bool shouldRepaint(_FlameSpritePainer old) => old._sprite != _sprite;
|
||||
bool shouldRepaint(_FlameSpritePainer old) => old._sprite != _sprite || old._center != _center;
|
||||
|
||||
@override
|
||||
void paint(Canvas canvas, Size size) {
|
||||
|
||||
Reference in New Issue
Block a user