Skip to content

Commit

Permalink
merged sidebar with map rescaling
Browse files Browse the repository at this point in the history
  • Loading branch information
valteu committed May 20, 2024
1 parent b8c8b89 commit 17d655e
Showing 1 changed file with 31 additions and 4 deletions.
35 changes: 31 additions & 4 deletions source/GM-TE/GMTETileMap.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,15 @@ GMTETileMap >> borderTileWidth: anObject [
borderTileWidth := anObject.
]

{
#category : #updating,
#'squeak_changestamp' : 'Valentin Teutschbein 5/20/2024 20:18'
}
GMTETileMap >> clearTiles [

self gridTileMatrix do: [:aTile | aTile delete]
]

{
#category : #'import/export',
#'squeak_changestamp' : 'Alex M 5/20/2024 13:15'
Expand All @@ -118,6 +127,16 @@ GMTETileMap >> exportAsImage [
self exportAsPNG
]

{
#category : #accessing,
#'squeak_changestamp' : 'Valentin Teutschbein 5/20/2024 20:10'
}
GMTETileMap >> extent: aPoint [

self gridTileMatrix ifNotNil: [self rescaleMap].
super extent: aPoint.
]

{
#category : #accessing,
#'squeak_changestamp' : 'Ivo Zilkenat 5/19/2024 15:57'
Expand Down Expand Up @@ -323,17 +342,25 @@ GMTETileMap >> processTiles [

{
#category : #updating,
#'squeak_changestamp' : 'Ivo Zilkenat 5/19/2024 15:57'
#'squeak_changestamp' : 'Valentin Teutschbein 5/20/2024 20:14'
}
GMTETileMap >> rescaleMap [

self rescaleMapWidth: self tileWidth height: self tileHeight padding: self mapPadding
]

{
#category : #updating,
#'squeak_changestamp' : 'Valentin Teutschbein 5/20/2024 20:18'
}
GMTETileMap >> rescaleMapWidth: aWidth height: aHeigth padding: aPadding [
"Rescale map & trigger update"

"Warning: If padding is to small relative to map, divisions by zero can occur"

self gridTileMatrix do: [:aTile | aTile delete].
self clearTiles.
self setDimensionsWidth: aWidth height: aHeigth padding: aPadding.
self updateGrid

self updateMap
]

{
Expand Down

0 comments on commit 17d655e

Please sign in to comment.