-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PenShape is now based on Geometry package
- Loading branch information
1 parent
451c728
commit a83782d
Showing
23 changed files
with
176 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
" | ||
A PenBlocShapeDresserTest is a test class for testing the behavior of PenBlocShapeDresser | ||
" | ||
Class { | ||
#name : #PenBlocShapeDresserTest, | ||
#superclass : #TestCase, | ||
#category : #'Penfeld-Bloc-Tests-Dressers' | ||
} | ||
|
||
{ #category : #'tests - build geometry' } | ||
PenBlocShapeDresserTest >> testBuildCircle [ | ||
PenShape new shape: (GCircle center: 100 , 100 radius: 30); build. | ||
] | ||
|
||
{ #category : #'tests - build geometry' } | ||
PenBlocShapeDresserTest >> testBuildEllipse [ | ||
PenShape new shape: (GEllipse center: 40 , 10 vertex: 60 , 10 coVertex: 40 , 20); build. | ||
] | ||
|
||
{ #category : #'tests - build geometry' } | ||
PenBlocShapeDresserTest >> testBuildPolygon [ | ||
PenShape new shape: (GPolygon vertices: {(10 , 10) . (-10 , 10) . (-10 , -10)}); build. | ||
] | ||
|
||
{ #category : #'tests - build geometry' } | ||
PenBlocShapeDresserTest >> testBuildRectangle [ | ||
PenShape new shape: (GRectangle origin: 1 , 3 corner: 3 , 0); build. | ||
] | ||
|
||
{ #category : #'tests - build geometry' } | ||
PenBlocShapeDresserTest >> testBuildTriangle [ | ||
PenShape new shape: (GTriangle with: 0 , 0 with: 2 , 0 with: 0 , 2); build. | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Extension { #name : #GCircle } | ||
|
||
{ #category : #'*Penfeld-Bloc' } | ||
GCircle >> asBlElement [ | ||
^ (BlCircle new extent: self extent) asElement | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Extension { #name : #GEllipse } | ||
|
||
{ #category : #'*Penfeld-Bloc' } | ||
GEllipse >> asBlElement [ | ||
^ (BlEllipse extent: self extent) asElement | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
Extension { #name : #GPolygon } | ||
|
||
{ #category : #'*Penfeld-Bloc' } | ||
GPolygon >> asBlElement [ | ||
^ (BlPolygon new | ||
vertices: (self vertices collect: [ :gpoint | gpoint x @ gpoint y ])) | ||
asElement | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Extension { #name : #GRectangle } | ||
|
||
{ #category : #'*Penfeld-Bloc' } | ||
GRectangle >> asBlElement [ | ||
^ (BlRectangle new extent: self extent) asElement | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Extension { #name : #GTriangle } | ||
|
||
{ #category : #'*Penfeld-Bloc' } | ||
GTriangle >> asBlElement [ | ||
^ (BlPolygon new vertices: { | ||
self v1 x @ self v1 y. | ||
self v2 x @ self v2 y. | ||
self v3 x @ self v3 y. }) asElement | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
Class { | ||
#name : #PenBlocShapeDresser, | ||
#superclass : #PenBlocDresser, | ||
#traits : 'TPenBlocSizeStyle + TPenBlocMarginStyle + TPenBlocBackgroundStyle + TPenBlocBorderStyle', | ||
#classTraits : 'TPenBlocSizeStyle classTrait + TPenBlocMarginStyle classTrait + TPenBlocBackgroundStyle classTrait + TPenBlocBorderStyle classTrait', | ||
#category : #'Penfeld-Bloc-Dressers' | ||
} | ||
|
||
{ #category : #dressing } | ||
PenBlocShapeDresser >> doAfterApplyStyle [ | ||
| var element | | ||
element := self component engineElement. | ||
|
||
"Position" | ||
var := self component position. | ||
var ifNotNil: [ element relocate: var ]. | ||
|
||
"Width" | ||
var := self component width. | ||
var ifNotNil: [ element width: var pref ]. | ||
|
||
"Height" | ||
var := self component height. | ||
var ifNotNil: [ element height: var pref ]. | ||
] | ||
|
||
{ #category : #dressing } | ||
PenBlocShapeDresser >> initEngineElement [ | ||
| element | | ||
element := self component shape asBlElement. | ||
element | ||
border: BlBorder empty; | ||
background: BlBackground transparent. | ||
|
||
self component hasEvents ifFalse: [ element preventMeAndChildrenMouseEvents ]. | ||
|
||
self component engineElement: element . | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.