@@ -4,8 +4,9 @@ import { ThirdPersonCamera, Tilemap, useThirdPersonCameraContext } from '../../.
44import { EasingType } from '../../../types/EasingType' ;
55import { MotionSettings } from '../../../types/Motions' ;
66import { SpriteDefinition } from '../../../types/SpriteDefinition' ;
7- import { TilePosition } from '../../../types/TilePosition' ;
87import { grass , mountain } from '../../__Sprites__' ;
8+ import { Position } from '../../../types/Position' ;
9+ import { useTilemapContext } from '../../../components/Tilemap/TilemapContext/useTilemapContext' ;
910
1011export type DemoThirdPersonCameraContextProps = {
1112 cameraMotionEasingType : EasingType ;
@@ -30,15 +31,15 @@ const sprites: SpriteDefinition[] = [
3031] ;
3132
3233const scheme : string [ ] [ ] [ ] = [
33- [ [ 'grass' ] , [ 'grass' ] , [ 'grass' ] ] ,
34- [ [ 'grass' ] , [ 'mountain' ] , [ 'grass' ] ] ,
35- [ [ 'grass' ] , [ 'grass' ] , [ 'grass' ] ] ,
34+ [ [ 'grass' ] , [ 'grass' ] , [ 'grass' ] , [ 'grass' ] ] ,
35+ [ [ 'grass' ] , [ 'mountain' ] , [ 'grass' ] , [ 'grass' ] ] ,
36+ [ [ 'grass' ] , [ 'grass' ] , [ 'grass' ] , [ 'grass' ] ] ,
3637] ;
3738
3839const initialZoom = 20 ;
3940
4041const ContextButtons = ( props : {
41- focusedTile : TilePosition | null ;
42+ focusedTile : Position | null ;
4243 cameraMotionEasingType : EasingType ;
4344 cameraMotionSpeed : number ;
4445 cameraMotionMinDuration ?: number ;
@@ -48,7 +49,8 @@ const ContextButtons = (props: {
4849 zoomMotionMinDuration ?: number ;
4950 zoomMotionMaxDuration ?: number ;
5051} ) => {
51- const { zoom, addCameraMotion, addZoomMotion } = useThirdPersonCameraContext ( ) ;
52+ const { computed } = useTilemapContext ( ) ;
53+ const { zoom, addCameraMotion, addZoomMotion, currentCameraMotion } = useThirdPersonCameraContext ( ) ;
5254
5355 const cameraMotion : MotionSettings = {
5456 speed : props . cameraMotionSpeed ,
@@ -134,16 +136,28 @@ const ContextButtons = (props: {
134136 >
135137 ZoomOut
136138 </ button >
139+ < p >
140+ Dimensions: { computed . mapDimensions . rows } rows / { computed . mapDimensions . cols } cols
141+ </ p >
142+ < p >
143+ isResizing: { computed . isResizing ? 'true' : 'false' }
144+ </ p >
145+ < p >
146+ isZoomin: { computed . isZooming ? 'true' : 'false' }
147+ </ p >
148+ < p >
149+ isCameraMotion: { currentCameraMotion != undefined ? 'true' : 'false' }
150+ </ p >
137151 </ >
138152 ) ;
139153} ;
140154
141155export const DemoThirdPersonCameraContext : FunctionComponent < DemoThirdPersonCameraContextProps > = (
142156 props
143157) => {
144- const [ focusedTile , setFocusedTile ] = React . useState < TilePosition | null > ( null ) ;
158+ const [ focusedTile , setFocusedTile ] = React . useState < Position | null > ( null ) ;
145159
146- const handleTileClick = ( tilePos : TilePosition ) => {
160+ const handleTileClick = ( tilePos : Position ) => {
147161 setFocusedTile ( tilePos ) ;
148162 } ;
149163
0 commit comments