Skip to content

Commit

Permalink
fix(math): fix the grid was displayed incorrectly (#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
xs10l3 authored Oct 4, 2024
1 parent 302c526 commit 26aa362
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions extensions/math/src/number-plane.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ export interface NumberPlaneOptions extends WidgetOptions, Growable {
fontSizeY?: number // Font size
rangesY: [number, number]
grid?: string
grid?: boolean
gridColor?: string
gridWidth?: number
}
Expand Down Expand Up @@ -60,19 +61,21 @@ const options = defineWidget<NumberPlaneOptions>(props)
0
</Text>
<Line
v-if="options.grid"
v-for="i in Math.abs(options.rangesX[1] - options.rangesX[0]) + 1"
:from="[i * (options.intervalX ?? 100), options.rangesY[0] * (options.intervalY ?? 100)]"
:to="[i * (options.intervalX ?? 100), options.rangesY[1] * (options.intervalY ?? 100)]"
:border-color="options.grid ?? 'white'"
:border-color="options.gridColor ?? 'white'"
:border-width="options.gridWidth ?? 1"
:x="(options.rangesX[0] - 1) * (options.intervalX ?? 100)"
:progress="options.progress ?? 1"
/>
<Line
v-if="options.grid"
v-for="i in Math.abs(options.rangesY[1] - options.rangesY[0]) + 1"
:from="[options.rangesX[0] * (options.intervalX ?? 100), i * (options.intervalY ?? 100)]"
:to="[options.rangesX[1] * (options.intervalX ?? 100), i * (options.intervalY ?? 100)]"
:border-color="options.grid ?? 'white'"
:border-color="options.gridColor ?? 'white'"
:border-width="options.gridWidth ?? 1"
:y="(options.rangesY[0] - 1) * (options.intervalY ?? 100)"
:progress="options.progress ?? 1"
Expand Down

0 comments on commit 26aa362

Please sign in to comment.