Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Traces to Exploriants #140

Merged
merged 8 commits into from
Feb 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions packages/Sandblocks-Babylonian/Object.extension.st
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
Extension { #name : #Object }

{ #category : #'*Sandblocks-Babylonian' }
Object >> asSBWatchValue [

^ SBWatchValue
value: self sbSnapshot
identityHash: self identityHash
]

{ #category : #'*Sandblocks-Babylonian' }
Object class >> exampleBlock [

Expand Down
27 changes: 22 additions & 5 deletions packages/Sandblocks-Babylonian/SBCluster.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,17 @@ SBCluster >> newTopRowFrom: aCollectionOfMorphs [
(self wrapInCell: aMorph owner flexVertically: true flexHorizontally: false) borderWidth: 0])
]

{ #category : #visualisation }
SBCluster >> sortedWatchValuesFor: anExample givenWatches: aCollectionOfWatches [

| allValues |
allValues := SortedCollection sortBlock: [:a :b | a chronologicalPosition <= b chronologicalPosition].
aCollectionOfWatches exampleToDisplay at: anExample
ifPresent: [:aSBWatchView | allValues addAll: aSBWatchView watchValues ]
ifAbsent: [{}].
^ allValues
]

{ #category : #visualisation }
SBCluster >> visualize [

Expand All @@ -117,9 +128,7 @@ SBCluster >> visualize [

matrix := self buildDisplayMatrix.
(matrix rowCount < 2 or: [matrix columnCount < 2])
ifTrue:[
self addMorph: (SBOwnTextMorph new contents: 'No watches to display').
^ self].
ifTrue:[self visualizeNothingToDisplay. ^ self].

self addAllMorphsBack: {
self newTopRowFrom: (matrix atRow: 1) allButFirst. "ignore placeholder morph"
Expand All @@ -133,6 +142,13 @@ SBCluster >> visualize [
collect: [:aMorph | self wrapInCell: aMorph])}}
]

{ #category : #visualisation }
SBCluster >> visualizeNothingToDisplay [

self addMorph: (SBOwnTextMorph new contents: 'No watches to display')

]

{ #category : #helper }
SBCluster >> wrapInCell: aMorph [

Expand All @@ -151,12 +167,13 @@ SBCluster >> wrapInCell: aMorph flexVertically: aVBoolean flexHorizontally: aHBo

(((aMorph fullBounds extent <= cell extent)
or: [aVBoolean and: (aMorph fullBounds width <= cell width)])
or: [aHBoolean and: (aMorph fullBounds height <= cell height)])
or: [aHBoolean and: (aMorph fullBounds height <= cell height)]
or: [aVBoolean and: aHBoolean])
ifTrue: [cell addMorph: aMorph. ^ cell].

targetExtent := cell extent - (cell borderWidth@cell borderWidth).
aVBoolean ifTrue: [targetExtent setX: targetExtent x setY: aMorph fullBounds height].
aHBoolean ifTrue: [targetExtent setX: aMorph fullBounds width setY: targetExtent height].
aHBoolean ifTrue: [targetExtent setX: aMorph fullBounds width setY: targetExtent y].

self flag: #todo. "Another way besides turning into an image to keep interactions.-jb"
cell addMorph: (ImageMorph new
Expand Down
Loading
Loading