diff --git a/source/GM-TE/GMTEEditor.class.st b/source/GM-TE/GMTEEditor.class.st index f442ae95..fce3c37a 100644 --- a/source/GM-TE/GMTEEditor.class.st +++ b/source/GM-TE/GMTEEditor.class.st @@ -430,7 +430,7 @@ GMTEEditor >> createInspectorSpecWithBuilder: aBuilder [ { #category : #building, - #'squeak_changestamp' : 'TW 6/23/2024 23:14' + #'squeak_changestamp' : 'jj 6/23/2024 23:48' } GMTEEditor >> createLayersSpecWithBuilder: aBuilder [ "creates the spec for layer viewer" @@ -442,7 +442,7 @@ GMTEEditor >> createLayersSpecWithBuilder: aBuilder [ fractions: (0.8 @ 0.25 corner: 1 @ 1)); children: { (aBuilder pluggablePanelSpec new) - frame: (LayoutFrame fractions: (1 @ 0 corner: 1 @ 1) offsets: (-30 @ 30 corner: 0 @ 0)); + frame: (LayoutFrame fractions: (0.85 @ 0 corner: 1 @ 1) offsets: (0 @ 30 corner: 0 @ 0)); children: { (aBuilder pluggableImageButtonSpec new) @@ -508,7 +508,7 @@ GMTEEditor >> createLayersSpecWithBuilder: aBuilder [ getSelectionList: #layerAt:; setSelectionList: #layerAt:put:; autoDeselect: false; - frame: (LayoutFrame fractions: (0 @ 0 corner: 1 @ 1) offsets: (0 @ 30 corner: -30 @ 0))}; + frame: (LayoutFrame fractions: (0 @ 0 corner: 0.85 @ 1) offsets: (0 @ 30 corner: 0 @ 0))}; verticalResizing: #shrinkWrap; yourself ] @@ -1336,15 +1336,15 @@ GMTEEditor >> selectOnlyLayer: anIndex [ { #category : #accessing, - #'squeak_changestamp' : 'jj 6/22/2024 21:40' + #'squeak_changestamp' : 'jj 6/24/2024 11:33' } GMTEEditor >> selectTile: anObject [ "selects a tile from the tile store" "TODO: might be problematic with tray. Maybe give tiles in the store IDs?" (anObject = self selectedTile) - ifTrue:[self unselectTile] - ifFalse:[ + ifTrue: [self unselectTile] + ifFalse: [ self selectedTile: anObject. self tileMap tileSelectionSet highlightImage: anObject fullResolutionSprite. self trayViewer morph submorphs first diff --git a/source/GM-TE/GMTEImageMorph.class.st b/source/GM-TE/GMTEImageMorph.class.st index 7bd15880..6362e88e 100644 --- a/source/GM-TE/GMTEImageMorph.class.st +++ b/source/GM-TE/GMTEImageMorph.class.st @@ -108,11 +108,12 @@ GMTEImageMorph >> setPlaceholderWithExtent: anExtent color: aColor [ { #category : #updating, - #'squeak_changestamp' : 'Ivo Zilkenat 6/24/2024 11:03' + #'squeak_changestamp' : 'Ivo Zilkenat 6/24/2024 11:55' } GMTEImageMorph >> updateSprite: anImage [ "Update sprite by also carrying the fullResolutionSprite" - self fullResolutionSprite: anImage. - self extent: self extent + self + fullResolutionSprite: anImage; + extent: self extent ] diff --git a/source/GM-TE/GMTETileMap.class.st b/source/GM-TE/GMTETileMap.class.st index 374b994f..993f5a41 100644 --- a/source/GM-TE/GMTETileMap.class.st +++ b/source/GM-TE/GMTETileMap.class.st @@ -113,12 +113,13 @@ GMTETileMap >> backgroundTiles [ { #category : #accessing, - #'squeak_changestamp' : 'Ivo Zilkenat 6/22/2024 01:21' + #'squeak_changestamp' : 'jj 6/24/2024 11:10' } GMTETileMap >> backgroundTiles: anObject [ - self basicBackgroundTiles: anObject. - self updateMap + self + basicBackgroundTiles: anObject; + updateMap ] @@ -278,15 +279,16 @@ GMTETileMap >> extent: aPoint [ { #category : #'dev-api', - #'squeak_changestamp' : 'Ivo Zilkenat 6/24/2024 11:18' + #'squeak_changestamp' : 'Ivo Zilkenat 6/24/2024 11:55' } -GMTETileMap >> fitBackgroundToMap [ +GMTETileMap >> fitBackgroundToMap [ "Forces the tile map morph to fit the map grid" - - self mapPadding: 0.0. - self forceMapSizeRatio: true. - self extent: (self mapSizeWidth) @ (self mapSizeHeight). - self changed + + self + mapPadding: 0.0; + forceMapSizeRatio: true; + extent: (self mapSizeWidth) @ (self mapSizeHeight); + changed ] { @@ -345,7 +347,7 @@ GMTETileMap >> fullGridSizeWidth: anObject [ { #category : #initialization, - #'squeak_changestamp' : 'Ivo Zilkenat 6/24/2024 11:23' + #'squeak_changestamp' : 'Ivo Zilkenat 6/24/2024 11:55' } GMTETileMap >> generateBackgroundTiles [ "Fill the background matrix stack with tiles automatically" @@ -353,7 +355,7 @@ GMTETileMap >> generateBackgroundTiles [ self backgroundTiles ifNil: [^ nil]. self tileMatrixStackBackground doTilesXYLidx: [ :x :y :l | - "It is assumed that the visual stack consists of only one layer" + "It is assumed that the background stack consists of only one layer" self generateTileAtlayer: l x: x y: y stack: self tileMatrixStackBackground tileType: GMTETile posCorrectionBlock: [ :aPoint | self correctedTilePositionBackground: aPoint]]. @@ -361,7 +363,6 @@ GMTETileMap >> generateBackgroundTiles [ tile applyTileSprite: self backgroundTiles] - ] { @@ -463,13 +464,14 @@ GMTETileMap >> getTileFromLayer: aLayer x: x y: y stack: aStack [ { #category : #'dev-api', - #'squeak_changestamp' : 'Ivo Zilkenat 6/24/2024 11:20' + #'squeak_changestamp' : 'Ivo Zilkenat 6/24/2024 11:55' } GMTETileMap >> hideVisualLayer [ "Hide the grid" - self tileMatrixStackVisual visible: false. - self changed + self + tileMatrixStackVisual visible: false; + changed ] @@ -494,14 +496,15 @@ GMTETileMap >> initialize [ { #category : #'dev-api', - #'squeak_changestamp' : 'Ivo Zilkenat 6/24/2024 11:19' + #'squeak_changestamp' : 'Ivo Zilkenat 6/24/2024 11:56' } GMTETileMap >> mapGridOnly [ "Fit background to grid and make it transparent if background generation is disabled" - - self fitBackgroundToMap. - self color: Color transparent. - self changed + + self + fitBackgroundToMap; + color: Color transparent; + changed ] { @@ -652,7 +655,7 @@ GMTETileMap >> rescaleMapWidth: aWidth height: aHeigth [ { #category : #updating, - #'squeak_changestamp' : 'Ivo Zilkenat 6/8/2024 21:59' + #'squeak_changestamp' : 'jj 6/24/2024 11:05' } GMTETileMap >> rescaleMapWidth: aWidth height: aHeigth padding: aPadding [ "Rescale map & trigger update" @@ -662,26 +665,26 @@ GMTETileMap >> rescaleMapWidth: aWidth height: aHeigth padding: aPadding [ sizeChanged := (aWidth ~= self mapTileWidth) or: [aHeigth ~= self mapTileHeight]. self setDimensionsWidth: aWidth height: aHeigth padding: aPadding. - (sizeChanged) ifTrue: [ - self rescaleMatrixStacks]. + sizeChanged ifTrue: [self rescaleMatrixStacks]. self updateMap ] { #category : #updating, - #'squeak_changestamp' : 'Ivo Zilkenat 6/24/2024 11:28' + #'squeak_changestamp' : 'Ivo Zilkenat 6/24/2024 11:55' } GMTETileMap >> rescaleMatrixStacks [ "Rescale matrix stacks to apply new dimensions" - (self tileMatrixStack) ifNotNil: [ + self tileMatrixStack ifNotNil: [ self tileMatrixStack rescaleToWidth: self mapTileWidth height: self mapTileHeight]. "Rescaling returns a copy of the original tiles, which must be added as submorphs again. TODO: move responsibility to Stack?" self tileMatrixStack doTiles: [ :tile | self addMorph: tile]. - (self tileMatrixStackVisual) ifNotNil: [ - self tileMatrixStackVisual rescaleToWidth: self mapTileWidth height: self mapTileHeight. - self tileMatrixStackVisual reset. + self tileMatrixStackVisual ifNotNil: [ + self tileMatrixStackVisual + rescaleToWidth: self mapTileWidth height: self mapTileHeight; + reset. self generateVisualTiles] ] @@ -809,14 +812,14 @@ GMTETileMap >> tileHeight: anObject [ { #category : #conversion, - #'squeak_changestamp' : 'Ivo Zilkenat 6/24/2024 11:14' + #'squeak_changestamp' : 'Ivo Zilkenat 6/24/2024 11:55' } GMTETileMap >> tileIdxFromPosition: aPoint [ "Answer the sender with a tile index (matrix[index x y][index x]) from a pixel position" | uncorrectedPos idx | uncorrectedPos := self revertCorrectedTilePositionMap: aPoint. - idx := (uncorrectedPos x / self tileSizeWidth + 1)@(uncorrectedPos y / self tileSizeHeight + 1). + idx := (uncorrectedPos x / self tileSizeWidth + 1) @ (uncorrectedPos y / self tileSizeHeight + 1). idx := idx floor. ((self tileMatrixStackVisual layer: 1) validIdx: idx) ifFalse: [^ nil]. @@ -1131,7 +1134,7 @@ GMTETileMap >> updateTileMatrixStack: aStack posCorrectionBlock: aBlock [ { #category : #updating, - #'squeak_changestamp' : 'Ivo Zilkenat 6/24/2024 11:31' + #'squeak_changestamp' : 'Ivo Zilkenat 6/24/2024 11:55' } GMTETileMap >> updateTiles [ "Collectively update all matrix stacks and therefore all tiles contained within" @@ -1142,12 +1145,14 @@ GMTETileMap >> updateTiles [ (self tileMatrixStackBackground visible) ifTrue: [ - self tileMatrixStackBackground rescaleToWidth: self tileWidth height: self tileHeight. - self tileMatrixStackBackground reset. + self tileMatrixStackBackground + rescaleToWidth: self tileWidth height: self tileHeight; + reset. self generateBackgroundTiles. self updateTileMatrixStack: self tileMatrixStackBackground posCorrectionBlock: [ :aPoint | self correctedTilePositionBackground: aPoint]]. - self updateTileMatrixStack: self tileMatrixStack. - self updateTileMatrixStack: self tileMatrixStackVisual + self + updateTileMatrixStack: self tileMatrixStack; + updateTileMatrixStack: self tileMatrixStackVisual ] diff --git a/source/GM-TE/GMTETileMatrixLayer.class.st b/source/GM-TE/GMTETileMatrixLayer.class.st index 843c860f..cadd844c 100644 --- a/source/GM-TE/GMTETileMatrixLayer.class.st +++ b/source/GM-TE/GMTETileMatrixLayer.class.st @@ -96,13 +96,13 @@ GMTETileMatrixLayer >> displayName: anObject [ { #category : #enumerating, - #'squeak_changestamp' : 'Ivo Zilkenat 6/24/2024 11:39' + #'squeak_changestamp' : 'Ivo Zilkenat 6/24/2024 11:55' } GMTETileMatrixLayer >> doTiles: aBlock [ "Convenience method to apply aBlock to every tile (if not nil)" "Instance variable must be used here" - (contents) ifNil: [^ nil]. + contents ifNil: [^ nil]. self contents do: [:tile | tile ifNotNil: [aBlock value: tile]] ] diff --git a/source/GM-TE/GMTETileSelectionSet.class.st b/source/GM-TE/GMTETileSelectionSet.class.st index 58301a57..1e2e134e 100644 --- a/source/GM-TE/GMTETileSelectionSet.class.st +++ b/source/GM-TE/GMTETileSelectionSet.class.st @@ -20,12 +20,13 @@ GMTETileSelectionSet >> applyHighlightingVisuals: aTile [ { #category : #highlighting, - #'squeak_changestamp' : 'Ivo Zilkenat 6/24/2024 11:51' + #'squeak_changestamp' : 'Ivo Zilkenat 6/24/2024 11:55' } GMTETileSelectionSet >> clearAllHighlightings [ "Clear tile selection and remove applied highlightings if any" - self do: [ :tile | self removeHighlightingVisuals: tile]. + self do: [ :tile | + self removeHighlightingVisuals: tile]. self removeAll ] diff --git a/source/GM-TE/GMTETileVisual.class.st b/source/GM-TE/GMTETileVisual.class.st index 3c20ffcb..85b3ef41 100644 --- a/source/GM-TE/GMTETileVisual.class.st +++ b/source/GM-TE/GMTETileVisual.class.st @@ -30,7 +30,7 @@ GMTETileVisual >> applyBorderHighlighting [ { #category : #highlighting, - #'squeak_changestamp' : 'Ivo Zilkenat 6/24/2024 11:04' + #'squeak_changestamp' : 'Ivo Zilkenat 6/24/2024 11:55' } GMTETileVisual >> applyDecoMorphHighlighting: aForm [ "Set a form as a temporary decoration inside the tile" @@ -38,15 +38,18 @@ GMTETileVisual >> applyDecoMorphHighlighting: aForm [ | newDecoMorph | aForm ifNotNil: [ - newDecoMorph := ImageMorph new - bounds: self bounds. - newDecoMorph image: (aForm scaledToSize: self extent)] + newDecoMorph := (ImageMorph new) + bounds: self bounds; + image: (aForm scaledToSize: self extent); + yourself] ifNil: [ newDecoMorph := Morph new - bounds: self bounds. - newDecoMorph color: (Color black alpha: GMTETileVisual decoMorphAlphaValue)]. - self addMorph: newDecoMorph. - self decorationMorph: newDecoMorph + bounds: self bounds; + color: (Color black alpha: GMTETileVisual decoMorphAlphaValue); + yourself]. + self + addMorph: newDecoMorph; + decorationMorph: newDecoMorph ] {