From 110e706893f82c25c7d7552fb3dc62780c4378a6 Mon Sep 17 00:00:00 2001 From: Fresneau Tony Date: Wed, 28 Jun 2023 14:51:20 +0200 Subject: [PATCH] 0.0.12 update --- README.md | 2 +- package.json | 2 +- src/runtime/components/NuxtRating.vue | 7 ++++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index e60b391..f5c9ff5 100644 --- a/README.md +++ b/README.md @@ -73,7 +73,7 @@ The following props can be passed to customize the appearance and behavior of th The component emits the following events: - `ratingSelected`: Triggered when a rating level is selected. The event payload is the selected rating value. -- `hoverRating`: Triggered when the mouse hovers over the rating meter. The event payload is the mouse event object. +- `ratingHovered`: Triggered when the mouse hovers over the rating meter. The event payload is the selected rating value. diff --git a/package.json b/package.json index 32a86d8..486ad32 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nuxt-rating", - "version": "0.0.1", + "version": "0.0.12", "description": "Display or retrieve a score on a fully customisable scale.", "homepage": "https://github.com/Aurion72/nuxt-rating#readme", "repository": "Aurion72/nuxt-rating", diff --git a/src/runtime/components/NuxtRating.vue b/src/runtime/components/NuxtRating.vue index 9eed659..4dfae2a 100644 --- a/src/runtime/components/NuxtRating.vue +++ b/src/runtime/components/NuxtRating.vue @@ -31,7 +31,7 @@ type Props = { const emit = defineEmits<{ ratingSelected: [rate: number]; - hoverRating: [event: MouseEvent]; + ratingHovered: [event: number]; }>(); const props = withDefaults(defineProps(), { @@ -63,7 +63,7 @@ const cssVars = computed(() => ({ const handleMouseMove = (event: MouseEvent) => { if (props.readOnly) return; - emit("hoverRating", event); + emit("ratingHovered", calculateRating(event)); hoveredRating.value = calculateRating(event); }; @@ -95,6 +95,7 @@ function calculateRating(event: MouseEvent): number { width: auto; display: inline-block; vertical-align: baseline; + height: 0px; font-size: var(--rating-size); cursor: var(--cursor-type); } @@ -102,7 +103,7 @@ function calculateRating(event: MouseEvent): number { .average-rating::before { --percent: calc(var(--rating-value) / var(--rating-count) * 100%); content: var(--rating-content); - position: absolute; + position: relative; top: 0; left: 0; color: rgba(0, 0, 0, 0.2);