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

Spelling #65

Merged
merged 7 commits into from
Jul 14, 2023
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
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ npm install @memgraph/orb
```

Below you can find a simple Typescript example using Orb to visualize a small graph. Feel
free to check other Javascript examples in `examples/` directory.
free to check other JavaScript examples in `examples/` directory.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

brand


```typescript
import { Orb } from '@memgraph/orb';
Expand Down Expand Up @@ -84,8 +84,8 @@ orb.view.render(() => {
<script src="https://unpkg.com/@memgraph/orb/dist/browser/orb.min.js"></script>
```

Below you can find a simple Javascript example using Orb to visualize a small graph. Feel
free to check other Javascript examples in `examples/` directory.
Below you can find a simple JavaScript example using Orb to visualize a small graph. Feel
free to check other JavaScript examples in `examples/` directory.

```html
<!DOCTYPE html>
Expand Down
4 changes: 2 additions & 2 deletions docs/styles.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ import { Color } from '@memgraph/orb';
// Constructor always receives a color HEX code
const red = new Color('#FF0000');

// Returns darker or ligher color by input factor (default is 0.3)
// Returns darker or lighter color by input factor (default is 0.3)
const darkerRed = red.getDarkerColor();
const lighterRed = red.getLighterColor();

Expand All @@ -183,7 +183,7 @@ const randomColor = Color.getRandomColor();
```

If you would like to have a lighter/darker tone of a node on node select/hover, then you can easily do
that with `getLigherColor` or `getDarkerColor` functions:
that with `getLighterColor` or `getDarkerColor` functions:

```typescript
const nodeBaseColor = new Color('#FF0000');
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/canvas/canvas-renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ export class CanvasRenderer<N extends INodeBase, E extends IEdgeBase> extends Em
/**
* Returns the visible rectangle view in the simulation coordinates.
*
* @return {IRectangle} Visible view in teh simulation coordinates
* @return {IRectangle} Visible view in the simulation coordinates
*/
getSimulationViewRectangle(): IRectangle {
const topLeftPosition = this.getSimulationPosition({ x: 0, y: 0 });
Expand Down
8 changes: 4 additions & 4 deletions src/renderer/canvas/edge/types/edge-curved.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const getCurvedArrowShape = <N extends INodeBase, E extends IEdgeBase>(ed

const controlPoint = edge.getCurvedControlPoint();
const arrowPoint = findBorderPoint(edge, target);
const guidePos = getPointBrezier(edge, Math.max(0.0, Math.min(1.0, arrowPoint.t + guideOffset)), controlPoint);
const guidePos = getPointBezier(edge, Math.max(0.0, Math.min(1.0, arrowPoint.t + guideOffset)), controlPoint);
const angle = Math.atan2(arrowPoint.y - guidePos.y, arrowPoint.x - guidePos.x);

const length = 1.5 * scaleFactor + 3 * lineWidth; // 3* lineWidth is the width of the edge.
Expand All @@ -55,10 +55,10 @@ export const getCurvedArrowShape = <N extends INodeBase, E extends IEdgeBase>(ed
*
* @param {EdgeCurved} edge Edge
* @param {number} percentage Percentage of the line to get position from
* @param {IPosition} viaNode Brezier node on the curved line
* @param {IPosition} viaNode Bezier node on the curved line
* @return {IPosition} Position on the line
*/
const getPointBrezier = <N extends INodeBase, E extends IEdgeBase>(
const getPointBezier = <N extends INodeBase, E extends IEdgeBase>(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm hoping I'm right...

edge: EdgeCurved<N, E>,
percentage: number,
viaNode: IPosition,
Expand Down Expand Up @@ -111,7 +111,7 @@ const findBorderPoint = <N extends INodeBase, E extends IEdgeBase>(
while (low <= high && iteration < maxIterations) {
middle = (low + high) * 0.5;

pos = { ...getPointBrezier(edge, middle, viaNode), t: 0 };
pos = { ...getPointBezier(edge, middle, viaNode), t: 0 };
// angle = Math.atan2(nodePoints.y - pos.y, nodePoints.x - pos.x);
// distanceToBorder = node.getDistanceToBorder(angle);
distanceToBorder = node.getDistanceToBorder();
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export interface IRenderer<N extends INodeBase, E extends IEdgeBase> extends IEm
/**
* Returns the visible rectangle view in the simulation coordinates.
*
* @return {IRectangle} Visible view in teh simulation coordinates
* @return {IRectangle} Visible view in the simulation coordinates
*/
getSimulationViewRectangle(): IRectangle;

Expand Down
8 changes: 4 additions & 4 deletions src/utils/emitter.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ export interface IEmitter<T extends IEventMap> {
removeAllListeners<K extends IEventKey<T>>(eventName?: K): IEmitter<T>;
}

interface IEmmiterListener<T extends IEventMap> {
interface IEmitterListener<T extends IEventMap> {
callable: IEventReceiver<T[any]>;
isOnce?: boolean;
}

export class Emitter<T extends IEventMap> implements IEmitter<T> {
private readonly _listeners = new Map<IEventKey<T>, IEmmiterListener<T>[]>();
private readonly _listeners = new Map<IEventKey<T>, IEmitterListener<T>[]>();

/**
* Adds a one-time listener function for the event named eventName. The next time eventName is
Expand All @@ -34,7 +34,7 @@ export class Emitter<T extends IEventMap> implements IEmitter<T> {
* @return {IEmitter} Reference to the EventEmitter, so that calls can be chained
*/
once<K extends IEventKey<T>>(eventName: K, func: IEventReceiver<T[K]>): IEmitter<T> {
const newListener: IEmmiterListener<T> = {
const newListener: IEmitterListener<T> = {
callable: func,
isOnce: true,
};
Expand All @@ -61,7 +61,7 @@ export class Emitter<T extends IEventMap> implements IEmitter<T> {
* @return {IEmitter} Reference to the EventEmitter, so that calls can be chained
*/
on<K extends IEventKey<T>>(eventName: K, func: IEventReceiver<T[K]>): IEmitter<T> {
const newListener: IEmmiterListener<T> = {
const newListener: IEmitterListener<T> = {
callable: func,
};

Expand Down
2 changes: 1 addition & 1 deletion src/utils/entity.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* A key-value model that keeps an order of the elements by
* the input sort function.
*
* Insipration by NgRx/EntityState: https://github.com/ngrx/platform
* Inspired by NgRx/EntityState: https://github.com/ngrx/platform
*/
export interface IEntityState<K, V> {
getOne(id: K): V | undefined;
Expand Down
2 changes: 1 addition & 1 deletion src/utils/html.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const setupContainer = (container: HTMLElement, areCollapsedDimensionsAll
"[Orb] The graph container element and its parent don't have defined width properties.",
'If you are using percentage values,',
'please make sure that the parent element of the graph container has a defined position and width.',
"Setting the width of the graph container to an arbirtrary value of '400px'...",
"Setting the width of the graph container to an arbitrary value of '400px'...",
);
} else {
console.warn("[Orb] The graph container element doesn't have defined width. Setting width to 100%...");
Expand Down