Skip to content

Commit

Permalink
Merge pull request #31 from retejs/docs/typedoc
Browse files Browse the repository at this point in the history
Docs/typedoc
  • Loading branch information
Ni55aN authored Jul 19, 2023
2 parents 53fc7f6 + cd6c337 commit 3c4ca92
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 6 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/update-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ name: Update docs
on:
workflow_dispatch:
push:
branches: [ "main" ]
branches: ["main"]

jobs:
pull:
uses: retejs/.github/.github/workflows/update-docs.yml@main
secrets: inherit
with:
filename: '1.rete'
package: rete
filename: "6.rete-minimap-plugin"
package: rete-minimap-plugin
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ node_modules
.vscode/
npm-debug.log
dist
docs
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"description": "",
"scripts": {
"build": "rete build -c rete.config.ts",
"lint": "rete lint"
"lint": "rete lint",
"doc": "rete doc"
},
"author": "Vitaliy Stoliarov",
"license": "MIT",
Expand Down
28 changes: 26 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,18 @@ import { Rect } from './types'
type NodeSize = { width: number, height: number }

type ExpectedScheme = GetSchemes<
BaseSchemes['Node'] & NodeSize,
BaseSchemes['Connection']
BaseSchemes['Node'] & NodeSize,
BaseSchemes['Connection']
>
export type Transform = {
x: number
y: number
k: number
}
/**
* Extra signal types for minimap rendering
* @priority 10
*/
export type MinimapExtra =
| RenderSignal<'minimap', {
ratio: number
Expand All @@ -24,6 +28,19 @@ export type MinimapExtra =
translate(dx: number, dy: number): void
point(x: number, y: number): void
}>

/**
* Minimap plugin, triggers rendering of the minimap
* @priority 9
* @listens nodetranslated
* @listens nodecreated
* @listens noderemoved
* @listens translated
* @listens resized
* @listens noderesized
* @listens zoomed
* @emits render
*/
export class MinimapPlugin<Schemes extends ExpectedScheme> extends Scope<never, [Area2D<Schemes> | MinimapExtra, Root<Schemes>]> {
element!: HTMLElement
editor!: NodeEditor<Schemes>
Expand All @@ -33,6 +50,13 @@ export class MinimapPlugin<Schemes extends ExpectedScheme> extends Scope<never,
minDistance: number
boundViewport: boolean

/**
* @constructor
* @param props Plugin properties
* @param props.ratio minimap ratio. Default is `1`
* @param props.minDistance minimap minimum distance. Default is `2000`
* @param props.boundViewport whether to bound the mini-viewport to the minimap. Default is `false`
*/
constructor(private props?: { minDistance?: number, ratio?: number, boundViewport?: boolean }) {
super('minimap')

Expand Down

0 comments on commit 3c4ca92

Please sign in to comment.