Skip to content

Commit

Permalink
adding watched startangle and readme default prop values
Browse files Browse the repository at this point in the history
  • Loading branch information
jamacon36 committed Feb 25, 2021
1 parent 7fffb43 commit 6493006
Show file tree
Hide file tree
Showing 7 changed files with 143 additions and 25 deletions.
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,13 @@ export default {

## Available Props

| Prop | Type | Description | Required |
| ---------- | ------- | ------------------------------------------------------------------------ | -------- |
| options | Array | An array of values to appear in the slices of the wheel. | \* |
| blockSpin | Boolean | Used to disable the spin button. | |
| startAngle | Number | Set the degrees to which the wheel is initially rotated. (Defaults to 0) | |
| Prop | Type | Description | Default Value | Required |
| ------------ | ------- | -------------------------------------------------------- | ------------- | -------- |
| options | Array | An array of values to appear in the slices of the wheel. | [] | \* |
| blockSpin | Boolean | Used to disable the spin button. | false | |
| startAngle | Number | Set the degrees to which the wheel is initially rotated. | 0 | |
| canvasWidth | Number | Set the width of the canvas element. (Defaults to 500) | 500 | |
| canvasHeight | Number | Set the height of the canvas element. (Defaults to 500) | 500 | |

## Available Events

Expand Down
39 changes: 35 additions & 4 deletions dist/raffle-wheel.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@
//
//
//
//
//
//
//
//
//
//

var script = {
name: "RaffleWheel",
Expand All @@ -21,7 +28,18 @@ var script = {
props: {
options: Array,
blockSpin: Boolean,
startAngle: Number,
startAngle: {
type: Number,
default: 0,
},
canvasWidth: {
type: Number,
default: 500,
},
canvasHeight: {
type: Number,
default: 500,
},
},
methods: {
byte2Hex: function byte2Hex(n) {
Expand Down Expand Up @@ -144,6 +162,11 @@ var script = {
return b + c * (tc + -3 * ts + 3 * t);
},
},
watch: {
startAngle: function startAngle() {
this.start = this.startAngle;
},
},
mounted: function mounted() {
this.start = this.startAngle;
this.arc = Math.PI / (this.options.length / 2);
Expand Down Expand Up @@ -237,11 +260,19 @@ var __vue_render__ = function() {
return _c("div", { staticClass: "raffle-wheel" }, [
_c(
"button",
{ attrs: { disabled: _vm.blockSpin }, on: { click: _vm.spin } },
[_vm._v("Spin")]
{
staticClass: "raffle-wheel__button",
attrs: { disabled: _vm.blockSpin },
on: { click: _vm.spin }
},
[_vm._v("\n Spin\n ")]
),
_vm._v(" "),
_c("canvas", { ref: "wheel", attrs: { width: "500", height: "500" } })
_c("canvas", {
ref: "wheel",
staticClass: "raffle-wheel__canvas",
attrs: { width: _vm.canvasWidth, height: _vm.canvasHeight }
})
])
};
var __vue_staticRenderFns__ = [];
Expand Down
39 changes: 35 additions & 4 deletions dist/raffle-wheel.min.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
var RaffleWheel = (function (exports) {
'use strict';

//
//
//
//
//
//
//
//
//
//
Expand All @@ -24,7 +31,18 @@ var RaffleWheel = (function (exports) {
props: {
options: Array,
blockSpin: Boolean,
startAngle: Number,
startAngle: {
type: Number,
default: 0,
},
canvasWidth: {
type: Number,
default: 500,
},
canvasHeight: {
type: Number,
default: 500,
},
},
methods: {
byte2Hex: function byte2Hex(n) {
Expand Down Expand Up @@ -147,6 +165,11 @@ var RaffleWheel = (function (exports) {
return b + c * (tc + -3 * ts + 3 * t);
},
},
watch: {
startAngle: function startAngle() {
this.start = this.startAngle;
},
},
mounted: function mounted() {
this.start = this.startAngle;
this.arc = Math.PI / (this.options.length / 2);
Expand Down Expand Up @@ -240,11 +263,19 @@ var RaffleWheel = (function (exports) {
return _c("div", { staticClass: "raffle-wheel" }, [
_c(
"button",
{ attrs: { disabled: _vm.blockSpin }, on: { click: _vm.spin } },
[_vm._v("Spin")]
{
staticClass: "raffle-wheel__button",
attrs: { disabled: _vm.blockSpin },
on: { click: _vm.spin }
},
[_vm._v("\n Spin\n ")]
),
_vm._v(" "),
_c("canvas", { ref: "wheel", attrs: { width: "500", height: "500" } })
_c("canvas", {
ref: "wheel",
staticClass: "raffle-wheel__canvas",
attrs: { width: _vm.canvasWidth, height: _vm.canvasHeight }
})
])
};
var __vue_staticRenderFns__ = [];
Expand Down
39 changes: 35 additions & 4 deletions dist/raffle-wheel.umd.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@
//
//
//
//
//
//
//
//
//
//

var script = {
name: "RaffleWheel",
Expand All @@ -27,7 +34,18 @@
props: {
options: Array,
blockSpin: Boolean,
startAngle: Number,
startAngle: {
type: Number,
default: 0,
},
canvasWidth: {
type: Number,
default: 500,
},
canvasHeight: {
type: Number,
default: 500,
},
},
methods: {
byte2Hex: function byte2Hex(n) {
Expand Down Expand Up @@ -150,6 +168,11 @@
return b + c * (tc + -3 * ts + 3 * t);
},
},
watch: {
startAngle: function startAngle() {
this.start = this.startAngle;
},
},
mounted: function mounted() {
this.start = this.startAngle;
this.arc = Math.PI / (this.options.length / 2);
Expand Down Expand Up @@ -243,11 +266,19 @@
return _c("div", { staticClass: "raffle-wheel" }, [
_c(
"button",
{ attrs: { disabled: _vm.blockSpin }, on: { click: _vm.spin } },
[_vm._v("Spin")]
{
staticClass: "raffle-wheel__button",
attrs: { disabled: _vm.blockSpin },
on: { click: _vm.spin }
},
[_vm._v("\n Spin\n ")]
),
_vm._v(" "),
_c("canvas", { ref: "wheel", attrs: { width: "500", height: "500" } })
_c("canvas", {
ref: "wheel",
staticClass: "raffle-wheel__canvas",
attrs: { width: _vm.canvasWidth, height: _vm.canvasHeight }
})
])
};
var __vue_staticRenderFns__ = [];
Expand Down
17 changes: 12 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,8 @@
"roulette"
],
"author": "James Macon https://github.com/jamacon36/",
"license": "ISC"
"license": "ISC",
"dependencies": {
"core-js": "^3.9.0"
}
}
17 changes: 15 additions & 2 deletions src/Raffle-Wheel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<canvas
class="raffle-wheel__canvas"
ref="wheel"
width="500"
height="500"
:width="canvasWidth"
:height="canvasHeight"
></canvas>
</div>
</template>
Expand All @@ -32,6 +32,14 @@ export default {
type: Number,
default: 0,
},
canvasWidth: {
type: Number,
default: 500,
},
canvasHeight: {
type: Number,
default: 500,
},
},
methods: {
byte2Hex(n) {
Expand Down Expand Up @@ -154,6 +162,11 @@ export default {
return b + c * (tc + -3 * ts + 3 * t);
},
},
watch: {
startAngle() {
this.start = this.startAngle;
},
},
mounted() {
this.start = this.startAngle;
this.arc = Math.PI / (this.options.length / 2);
Expand Down

0 comments on commit 6493006

Please sign in to comment.