-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: RENAME types XXXMixin to XXXIns
- Loading branch information
1 parent
837fb4f
commit a2cd3c9
Showing
30 changed files
with
158 additions
and
87 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
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
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,58 @@ | ||
<script lang="ts" setup> | ||
import { computed } from "vue"; | ||
import { Vector } from "../animations/typings"; | ||
import type { FigureOptions } from "./figure"; | ||
import { defineWidget } from "@vue-motion/core"; | ||
import Polygon from "./polygon.vue"; | ||
import { widget, WidgetIns } from "./widget"; | ||
import type { Growable } from "../animations"; | ||
export interface ArrowOptions extends FigureOptions, Growable { | ||
from: Vector; | ||
to: Vector; | ||
} | ||
const props = defineProps<ArrowOptions>(); | ||
const options = defineWidget(props); | ||
const current = computed(() => { | ||
const dx = options.to[0] - options.from[0]; | ||
const dy = options.to[1] - options.from[1]; | ||
return { | ||
x: options.from[0] + dx * (options.progress ?? 1), | ||
y: options.from[1] + dy * (options.progress ?? 1), | ||
}; | ||
}); | ||
const rotation = computed(() => { | ||
const delta = [ | ||
options.to[0] - options.from[0], | ||
options.to[1] - options.from[1], | ||
]; | ||
return Math.atan2(delta[1], delta[0]); | ||
}); | ||
export type ArrowIns = ArrowOptions & WidgetIns; | ||
</script> | ||
|
||
<template> | ||
<g v-bind="widget(options)"> | ||
<line | ||
:x1="options.from[0]" | ||
:y1="options.from[1]" | ||
:x2="current.x" | ||
:y2="current.y" | ||
/> | ||
<g | ||
:transform="`translate(${current.x}, ${current.y}) rotate(${(rotation * 180) / Math.PI})`" | ||
> | ||
<Polygon | ||
:points="[ | ||
[0, -10], | ||
[0, 10], | ||
[Math.sqrt(300), 0], | ||
]" | ||
/> | ||
</g> | ||
</g> | ||
</template> |
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 |
---|---|---|
@@ -1,31 +1,33 @@ | ||
export { widget } from "./widget"; | ||
export type { WidgetOptions, WidgetMixin } from "./widget"; | ||
export type { WidgetOptions, WidgetIns } from "./widget"; | ||
export { figure } from "./figure"; | ||
export type { FigureOptions, FigureMixin } from "./figure"; | ||
export type { FigureOptions, FigureIns } from "./figure"; | ||
export { default as Group } from "./group.vue"; | ||
|
||
export { default as Arc } from "./arc.vue"; | ||
export type { ArcOptions, ArcMixin } from "./arc.vue"; | ||
export type { ArcOptions, ArcIns } from "./arc.vue"; | ||
export { default as Line } from "./line.vue"; | ||
export type { LineOptions, LineMixin } from "./line.vue"; | ||
export type { LineOptions, LineIns } from "./line.vue"; | ||
export { default as Polygon } from "./polygon.vue"; | ||
export type { PolygonOptions, PolygonMixin } from "./polygon.vue"; | ||
export type { PolygonOptions, PolygonIns } from "./polygon.vue"; | ||
export { default as Rect } from "./rect.vue"; | ||
export type { RectOptions, RectMixin } from "./rect.vue"; | ||
export type { RectOptions, RectIns } from "./rect.vue"; | ||
export { default as Ellipse } from "./ellipse.vue"; | ||
export type { EllipseOptions, EllipseMixin } from "./ellipse.vue"; | ||
export type { EllipseOptions, EllipseIns } from "./ellipse.vue"; | ||
export { default as Circle } from "./circle.vue"; | ||
export type { CircleOptions, CircleMixin } from "./circle.vue"; | ||
export type { CircleOptions, CircleIns } from "./circle.vue"; | ||
export { default as Text } from "./text.vue"; | ||
export type { TextOptions, TextMixin } from "./text.vue"; | ||
export type { TextOptions, TextIns } from "./text.vue"; | ||
export { default as TextUnit } from "./text-unit.vue"; | ||
export { default as Image } from "./image.vue"; | ||
export type { ImageOptions } from "./image.vue"; | ||
export { default as Mask } from "./mask.vue"; | ||
export type { MaskOptions } from "./mask.vue"; | ||
export { default as Path } from "./path.vue"; | ||
export type { PathOptions, PathMixin } from "./path.vue"; | ||
export type { PathOptions, PathIns } from "./path.vue"; | ||
export { default as WebView } from "./webview.vue"; | ||
export type { WebViewOptions, WebViewMixin } from "./webview.vue"; | ||
export type { WebViewOptions, WebViewIns } from "./webview.vue"; | ||
export { default as Video } from "./video.vue"; | ||
export type { VideoOptions } from "./video.vue"; | ||
export { default as Arrow } from "./arrow.vue"; | ||
export type { ArrowOptions, ArrowIns } from "./arrow.vue"; |
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.