-
Notifications
You must be signed in to change notification settings - Fork 279
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
refactor: Reorganize shapes #743
Conversation
Deploying with Cloudflare Pages
|
Codecov Report
@@ Coverage Diff @@
## main #743 +/- ##
==========================================
+ Coverage 65.01% 65.56% +0.54%
==========================================
Files 46 53 +7
Lines 8235 7939 -296
Branches 1534 1460 -74
==========================================
- Hits 5354 5205 -149
+ Misses 2872 2725 -147
Partials 9 9
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice! I liked the design in general. I had one minor comment about propTags
in Shape
and initShape
in the Style compiler. All the shape definitions look great to me!
@keenancrane In order to pass |
Description
Fixes #700, fixes #701, fixes #709, fixes #712, fixes #714. Joint work with @joshsunshine and @maxkrieger.
This PR does the following:
Callout
(it's gross)FreeformPolygon
(it's redundant withPolygon
)PathString
(it's redundant withPath
)Square
(it's redundant withRectangle
, and it's not in SVG, unlikeCircle
)Arrow
(it's redundant withLine
)renderer/ShapeDef
.types/shapes
with several newinterface
s holding commonly shared propertiesshapes/
directory holding most of the other things:shapes/Samplers
holding samplers, which now just sample rather than returning sampler functionsshapes/Shapes
:Shape
type that is the union of all individual concrete shape typesShapeDef
type, which holds metadata about shape typesshapedefs
object which maps from shape type names toShapeDef
sengine/BBox
engine/BBox
propertiesOf
andpropertiesNotOf
fromcompiler/Style
toengine/EngineUtils
getShapeName
fromrenderer/ShapeDef
toengine/PropagateUpdate
State
'suninitializedPaths
field asPath[]
instead ofany
arrowHead
andmakeRoomForArrows
fromrenderer/Arrow
torenderer/Line
compiler/Style
to use the new shapedefs and samplersrenderer/Resample
to very inefficiently use the new samplers instead of the old ones (need to fix this)examples/
and TypeScript code to get rid of the deleted shape types and migrate property namesexpand to see subtask tracking used while developing this
Rectangle
ShapeDef.test.ts
penrose/packages/core/src/compiler/Style.ts
Lines 2688 to 2692 in d73815d
Move content of render functions, e.g. the Arrow function below, to render methods in the Shape types:penrose/packages/core/src/renderer/Arrow.ts
Lines 84 to 87 in d73815d
Update Render.ts, in particular the function that renders each shape to call the new render methods:penrose/packages/core/src/renderer/Renderer.ts
Line 26 in d73815d
(temporarily?) remove all the dragging stuffget rid oftypes/shape
probablysrc/compiler/Style.test.ts
src/engine/BBox.test.ts
src/__tests__/overall.test.ts
Checklist
yarn test
yarn docs
and there were no errors when generating the HTML site(We don't currently check ESLint, but #755 will be a step on the path toward letting us do that. 🙂)
Future work
ShapeDef
to methods on theShape