@everymatrix/lottery-program-wof 1.22.8 → 1.22.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lottery-program-wof.js +159 -129
- package/dist/lottery-program-wof.js.map +1 -1
- package/package.json +2 -2
- package/src/business.partition.ts +25 -7
- package/src/class.svgcalc.ts +9 -5
- package/src/private.item.svg.svelte +4 -3
- package/src/private.message.svelte +1 -1
- package/src/private.outcomes.svelte +1 -1
- package/src/types.ts +1 -0
- package/src/util.ts +5 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@everymatrix/lottery-program-wof",
|
|
3
|
-
"version": "1.22.
|
|
3
|
+
"version": "1.22.10",
|
|
4
4
|
"main": "dist/lottery-program-wof.js",
|
|
5
5
|
"svelte": "src/index.ts",
|
|
6
6
|
"scripts": {
|
|
@@ -39,5 +39,5 @@
|
|
|
39
39
|
"publishConfig": {
|
|
40
40
|
"access": "public"
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "38495c8b7fed86d85f3362fe6419369936e0a28a"
|
|
43
43
|
}
|
|
@@ -10,7 +10,7 @@ import Thankyou3Svg from './images/Thankyou_3.svg'
|
|
|
10
10
|
import Thankyou4Svg from './images/Thankyou_4.svg'
|
|
11
11
|
import type { Lang } from './types'
|
|
12
12
|
import type { LotteryProgramForPlayer } from './types.business'
|
|
13
|
-
import { imageLoaderSvg } from './util'
|
|
13
|
+
import { imageLoaderSvg, isSafari } from './util'
|
|
14
14
|
|
|
15
15
|
export interface Option {
|
|
16
16
|
image: SVGElement | string,
|
|
@@ -69,12 +69,30 @@ export const getOptions = async (bonus: LotteryProgramForPlayer, lang: Lang) =>
|
|
|
69
69
|
|
|
70
70
|
const { partitions } = bonus.program.wheelOfFortune
|
|
71
71
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
72
|
+
let options: Option[] = getOptionsFromPartitions(partitions, lang)
|
|
73
|
+
|
|
74
|
+
if(isSafari()){
|
|
75
|
+
options = options.map(option => {
|
|
76
|
+
if(option.image){
|
|
77
|
+
let img = document.createElementNS("http://www.w3.org/2000/svg", "image")
|
|
78
|
+
img.href.baseVal = option.image as string
|
|
79
|
+
|
|
80
|
+
return {
|
|
81
|
+
...option,
|
|
82
|
+
image: img
|
|
83
|
+
}
|
|
84
|
+
}else{
|
|
85
|
+
return option
|
|
86
|
+
}
|
|
87
|
+
})
|
|
88
|
+
}else{
|
|
89
|
+
options = await Promise.all(
|
|
90
|
+
options.map(async o => ({
|
|
91
|
+
...o,
|
|
92
|
+
...(await preloadImage(o.image as string))
|
|
93
|
+
}))
|
|
94
|
+
)
|
|
95
|
+
}
|
|
78
96
|
|
|
79
97
|
return options
|
|
80
98
|
}
|
package/src/class.svgcalc.ts
CHANGED
|
@@ -76,7 +76,7 @@ export class SvgCalc {
|
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
return {
|
|
79
|
-
...this.getPropsForPartitionInfo(index, this.getOffsetImage(sizeImage), baseRadius),
|
|
79
|
+
...this.getPropsForPartitionInfo(index, this.getOffsetImage(sizeImage), baseRadius, ContentDirection.outward),
|
|
80
80
|
width: sizeImage,
|
|
81
81
|
height: sizeImage,
|
|
82
82
|
}
|
|
@@ -148,8 +148,11 @@ export class SvgCalc {
|
|
|
148
148
|
return RotateDirection.clockwise
|
|
149
149
|
}
|
|
150
150
|
|
|
151
|
-
getAngleSelf (index) {
|
|
152
|
-
|
|
151
|
+
getAngleSelf (index, contentDirection?: ContentDirection) {
|
|
152
|
+
const baseAngle = 360 * index / this.length * this.direction
|
|
153
|
+
const fixerAngle = 90 * (contentDirection !== undefined ? contentDirection : ContentDirection[this.contentdirection])
|
|
154
|
+
const resultAngle = baseAngle + fixerAngle
|
|
155
|
+
return resultAngle
|
|
153
156
|
}
|
|
154
157
|
|
|
155
158
|
getPartitionPositions (index, baseRadius, offset) {
|
|
@@ -171,7 +174,8 @@ export class SvgCalc {
|
|
|
171
174
|
getPropsForPartitionInfo (
|
|
172
175
|
index: number,
|
|
173
176
|
offset: any,
|
|
174
|
-
baseRadius?: number
|
|
177
|
+
baseRadius?: number,
|
|
178
|
+
contentDirection?: ContentDirection
|
|
175
179
|
) {
|
|
176
180
|
|
|
177
181
|
const { point, transformOrigin } = this.getPartitionPositions(index, baseRadius, offset)
|
|
@@ -183,7 +187,7 @@ export class SvgCalc {
|
|
|
183
187
|
...point,
|
|
184
188
|
style: [
|
|
185
189
|
`font-size: ${13 * this.ratio}px`,
|
|
186
|
-
`transform: rotate(${this.getAngleSelf(index)}deg)`,
|
|
190
|
+
`transform: rotate(${this.getAngleSelf(index, contentDirection)}deg)`,
|
|
187
191
|
`transform-origin: ${getTransformOriginString(transformOrigin)}`,
|
|
188
192
|
].join(';')
|
|
189
193
|
}
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
import { onMountMessageLifeCycle, _postMessage } from './message';
|
|
10
10
|
import type { LotteryProgramForPlayer } from './types.business';
|
|
11
11
|
import { themes } from './themes';
|
|
12
|
-
import { setProps } from './util';
|
|
12
|
+
import { isSafari, setProps } from './util';
|
|
13
13
|
import { Spinner } from './class.spinner';
|
|
14
14
|
import { SvgCalc } from './class.svgcalc';
|
|
15
15
|
import { Process } from './class.process';
|
|
@@ -187,6 +187,7 @@
|
|
|
187
187
|
bind:this={svg}
|
|
188
188
|
width={size}
|
|
189
189
|
height={size}
|
|
190
|
+
on:click={() => isSafari() && eventSpin()}
|
|
190
191
|
style:opacity={messageShown ? '.3': ''}
|
|
191
192
|
>
|
|
192
193
|
<foreignObject {...sizeProps} class="Bottom Customable" />
|
|
@@ -230,7 +231,7 @@
|
|
|
230
231
|
{...calc.getSvgTextPropsAdjustedByImage(index)}
|
|
231
232
|
>
|
|
232
233
|
<div class="PartitionTextEntityContainer">
|
|
233
|
-
<p class={`PartitionTextEntity${calc.contentdirection === 'clockwise' ? '' : ' Anticlockwise'}`}>{option.name}</p>
|
|
234
|
+
<p class={`PartitionTextEntity${calc.contentdirection === 'clockwise' ? '' : ' Anticlockwise'}`}>{@html option.name}</p>
|
|
234
235
|
</div>
|
|
235
236
|
</foreignObject>
|
|
236
237
|
{/if}
|
|
@@ -278,7 +279,7 @@
|
|
|
278
279
|
<g
|
|
279
280
|
class="Center"
|
|
280
281
|
class:disabled={isSpinning}
|
|
281
|
-
on:click={() => eventSpin()}
|
|
282
|
+
on:click={() => isSafari() || eventSpin()}
|
|
282
283
|
>
|
|
283
284
|
<foreignObject
|
|
284
285
|
x={Number(size)/2 - 100/2}
|
|
@@ -122,7 +122,7 @@
|
|
|
122
122
|
<tbody style={outcomesItem.outcomes.length <= 5 ? 'overflow: hidden;' : ''}>
|
|
123
123
|
{#each outcomesItem.outcomes as outcome}
|
|
124
124
|
<tr>
|
|
125
|
-
<td>{getPrize(outcome, outcomesItem.id)}</td>
|
|
125
|
+
<td>{@html getPrize(outcome, outcomesItem.id)}</td>
|
|
126
126
|
<td>{outcome.draw.state}</td>
|
|
127
127
|
<td>{(new Date(outcome.draw.time).toLocaleString(undefined, { timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone }))}</td>
|
|
128
128
|
</tr>
|
package/src/types.ts
CHANGED
package/src/util.ts
CHANGED