Skip to content

Commit

Permalink
feat(math): Add Ellipse Component
Browse files Browse the repository at this point in the history
-Implemented a new Ellipse Component for drawing ellipse shapes in the Math Extension
-The component supports custom properties such as center point, long axis, and short axis
-Use the definitions and properties of the Vue Motion library to implement component functionality
  • Loading branch information
xs10l3 committed Nov 23, 2024
1 parent ec03ca4 commit 8260662
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
32 changes: 32 additions & 0 deletions packages/lib/src/widgets/ellipse.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<script setup lang="ts">
import { defineProps } from 'vue'
import { defineWidget } from '@vue-motion/core'
import type { FigureMixin, FigureOptions } from './figure'
import { figure } from './figure'
export interface EllipseOptions extends FigureOptions {
cx: number
cy: number
rx: number
ry: number
width?: number
height?: number
radius?: number
}
export type EllipseMixin = EllipseOptions & FigureMixin
const props = defineProps<EllipseOptions>()
const options = defineWidget(props)
</script>

<template>
<ellipse
v-bind="figure(options)"
:cx="options.cx"
:cy="options.cy"
:rx="options.rx"
:ry="options.ry"
:width="options.width"
:height="options.height"
/>
</template>
2 changes: 2 additions & 0 deletions packages/lib/src/widgets/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ export { default as Polygon } from './polygon.vue'
export type { PolygonOptions, PolygonMixin } from './polygon.vue'
export { default as Rect } from './rect.vue'
export type { RectOptions, RectMixin } from './rect.vue'
export { default as Ellipse } from './ellipse.vue'
export type { EllipseOptions, EllipseMixin } from './ellipse.vue'
export { default as Text } from './text.vue'
export type { TextOptions, TextMixin } from './text.vue'
export { default as TextUnit } from './text-unit.vue'
Expand Down

0 comments on commit 8260662

Please sign in to comment.