-
Notifications
You must be signed in to change notification settings - Fork 18
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
Chore: Apply Emitter in simulator and fix cleanup when terminated, Refactor naming #25
Chore: Apply Emitter in simulator and fix cleanup when terminated, Refactor naming #25
Conversation
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.
Great refactoring! Now all events are structured as "event emitters" which is awesome!
Btw there is just one comment regarding name consistency.
src/simulator/shared.ts
Outdated
STABILIZATION_STARTED = 'stabilizationStarted', | ||
STABILIZATION_PROGRESS = 'stabilizationProgress', | ||
STABILIZATION_ENDED = 'stabilizationEnded', | ||
NODE_DRAGGED = 'nodeDragged', | ||
NODE_DRAG_ENDED = 'nodeDragEnded', | ||
SETTINGS_UPDATED = 'settingsUpdated', |
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.
Nitpicking, but now when you cleaned up Events in simulator engines and main classes, maybe it makes sense to make naming consistent with the rest of the library where:
- Event values are present simple (e.g.
render-start
,node-hover
,mouse-move
) - Event values are not camel case (e.g.
render-start
, ...)
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.
Yep! Makes sense. I'll also refactor these messages in the screenshot, as they are not written in MACRO_CASE
.
or maybe the best example is this one where both are clearly visible:
Btw regarding naming, I have a few more questions:
- We are using both
stabilization
andsimulation
. Should we merge those two? - In the picture above, should all of them be present simple?
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.
I would say yes
to both. Cleaner and consistent.
src/views/default-view.ts
Outdated
@@ -27,6 +29,7 @@ export interface IDefaultViewSettings<N extends INodeBase, E extends IEdgeBase> | |||
isOutOfBoundsDragEnabled: boolean; | |||
areCoordinatesRounded: boolean; | |||
isSimulationAnimated: boolean; | |||
areCollapsedContainerDimensionsAllowed: boolean; |
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.
Just don't forget to add this to the docs
for both views.
@tonilastre Applied the standardized naming convention and updated docs. Feel free to take one final glance. 🙂 |
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.
Some minor fixes are needed.
} | ||
tile: new L.TileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"), // OpenStreetMaps | ||
}, | ||
}; |
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.
Add areCollapsedContainerDimensionsAllowed
here and to the interface above.
src/simulator/shared.ts
Outdated
onStabilizationProgress: (data: ISimulatorEventGraph & ISimulatorEventProgress) => void; | ||
onStabilizationEnd: (data: ISimulatorEventGraph) => void; | ||
onSimulationStart: () => void; | ||
onSIMULATION_PROGRESS: (data: ISimulatorEventGraph & ISimulatorEventProgress) => void; |
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.
Khm :D
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.
It was bound to happen 😅
src/views/default-view.ts
Outdated
@@ -49,7 +50,7 @@ export class DefaultView<N extends INodeBase, E extends IEdgeBase> implements IO | |||
|
|||
private _isSimulating = false; | |||
private _onSimulationEnd: (() => void) | undefined; | |||
private _simulationStartedAt = Date.now(); | |||
private _simulationStartedAtAt = Date.now(); |
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.
Double At
.
@@ -204,7 +206,7 @@ that allows Orb to position the nodes. | |||
![](./assets/view-default-fixed.png) | |||
|
|||
```typescript | |||
import { DefaultView } from '@memgraph/orb'; | |||
import { DefaultView } from "@memgraph/orb"; |
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.
We have to align our formatters at some point. Seems like every time we open a markdown file and save it we have different outputs.
No description provided.