mirror of
https://github.com/flame-engine/flame.git
synced 2025-10-30 08:27:36 +08:00
docs: Update input examples to use RectangleComponent where sensible (#3745)
Update input examples to use `RectangleComponent` where sensible. Minor simplification as suggested by @spydon on https://github.com/flame-engine/flame/pull/3741
This commit is contained in:
@ -32,7 +32,7 @@ class HoverCallbacksWorld extends World with TapCallbacks {
|
||||
}
|
||||
}
|
||||
|
||||
class HoverSquare extends PositionComponent with HoverCallbacks {
|
||||
class HoverSquare extends RectangleComponent with HoverCallbacks {
|
||||
static final Paint _white = Paint()..color = const Color(0xFFFFFFFF);
|
||||
static final Paint _grey = Paint()..color = const Color(0xFFA5A5A5);
|
||||
|
||||
@ -44,7 +44,5 @@ class HoverSquare extends PositionComponent with HoverCallbacks {
|
||||
);
|
||||
|
||||
@override
|
||||
void render(Canvas canvas) {
|
||||
canvas.drawRect(size.toRect(), isHovered ? _grey : _white);
|
||||
}
|
||||
Paint get paint => isHovered ? _grey : _white;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user