@crispcode/shimmer 5.1.1 → 5.2.0
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +0 -4
- package/package.json +32 -32
- package/scripts/button.js +3 -3
- package/scripts/controls.js +10 -5
- package/scripts/shimmer.js +2 -8
- package/scripts/video.js +2 -2
- package/test/app.html +0 -2
- package/test/scripts/components/shimmer/index.js +1 -1
- package/test/scripts/components/shimmer/moon.js +3 -5
- package/test/styles/index.scss +1 -0
package/README.md
CHANGED
@@ -14,10 +14,6 @@ Clone the shimmer repository to your machine and use the following commands:
|
|
14
14
|
To generate a documentation use `npm run docs`
|
15
15
|
If you want to check functionality you can use `npm run test`
|
16
16
|
|
17
|
-
## Polyfill
|
18
|
-
|
19
|
-
In order to support older versions of browsers, you can use [polyfill.io](https://polyfill.io)
|
20
|
-
|
21
17
|
## Shimmer classes
|
22
18
|
|
23
19
|
|Name|Usage|Description|
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@crispcode/shimmer",
|
3
|
-
"version": "5.
|
3
|
+
"version": "5.2.0",
|
4
4
|
"description": "A PIXI.JS wrapper plugin for MODUX",
|
5
5
|
"author": "Crisp Code ( contact@crispcode.ro )",
|
6
6
|
"access": "public",
|
@@ -17,39 +17,39 @@
|
|
17
17
|
"url": "https://github.com/CrispCode/shimmer/issues"
|
18
18
|
},
|
19
19
|
"dependencies": {
|
20
|
-
"@pixi/assets": "^
|
21
|
-
"@pixi/canvas-display": "^
|
22
|
-
"@pixi/canvas-extract": "^
|
23
|
-
"@pixi/canvas-graphics": "^
|
24
|
-
"@pixi/canvas-mesh": "^
|
25
|
-
"@pixi/canvas-particle-container": "^
|
26
|
-
"@pixi/canvas-prepare": "^
|
27
|
-
"@pixi/canvas-renderer": "^
|
28
|
-
"@pixi/canvas-sprite": "^
|
29
|
-
"@pixi/canvas-sprite-tiling": "^
|
30
|
-
"@pixi/canvas-text": "^
|
31
|
-
"@pixi/constants": "^
|
32
|
-
"@pixi/core": "^
|
33
|
-
"@pixi/display": "^
|
34
|
-
"@pixi/
|
35
|
-
"@pixi/
|
36
|
-
"@pixi/
|
37
|
-
"@pixi/math": "^
|
38
|
-
"@pixi/mesh": "^
|
39
|
-
"@pixi/mesh-extras": "^
|
40
|
-
"@pixi/particle-container": "^
|
41
|
-
"@pixi/prepare": "^
|
42
|
-
"@pixi/runner": "^
|
43
|
-
"@pixi/settings": "^
|
44
|
-
"@pixi/sprite": "^
|
45
|
-
"@pixi/sprite-animated": "^
|
46
|
-
"@pixi/sprite-tiling": "^
|
47
|
-
"@pixi/text": "^
|
48
|
-
"@pixi/ticker": "^
|
49
|
-
"@pixi/utils": "^
|
20
|
+
"@pixi/assets": "^7.4.2",
|
21
|
+
"@pixi/canvas-display": "^7.4.2",
|
22
|
+
"@pixi/canvas-extract": "^7.4.2",
|
23
|
+
"@pixi/canvas-graphics": "^7.4.2",
|
24
|
+
"@pixi/canvas-mesh": "^7.4.2",
|
25
|
+
"@pixi/canvas-particle-container": "^7.4.2",
|
26
|
+
"@pixi/canvas-prepare": "^7.4.2",
|
27
|
+
"@pixi/canvas-renderer": "^7.4.2",
|
28
|
+
"@pixi/canvas-sprite": "^7.4.2",
|
29
|
+
"@pixi/canvas-sprite-tiling": "^7.4.2",
|
30
|
+
"@pixi/canvas-text": "^7.4.2",
|
31
|
+
"@pixi/constants": "^7.4.2",
|
32
|
+
"@pixi/core": "^7.4.2",
|
33
|
+
"@pixi/display": "^7.4.2",
|
34
|
+
"@pixi/events": "^7.4.2",
|
35
|
+
"@pixi/extensions": "^7.4.2",
|
36
|
+
"@pixi/graphics": "^7.4.2",
|
37
|
+
"@pixi/math": "^7.4.2",
|
38
|
+
"@pixi/mesh": "^7.4.2",
|
39
|
+
"@pixi/mesh-extras": "^7.4.2",
|
40
|
+
"@pixi/particle-container": "^7.4.2",
|
41
|
+
"@pixi/prepare": "^7.4.2",
|
42
|
+
"@pixi/runner": "^7.4.2",
|
43
|
+
"@pixi/settings": "^7.4.2",
|
44
|
+
"@pixi/sprite": "^7.4.2",
|
45
|
+
"@pixi/sprite-animated": "^7.4.2",
|
46
|
+
"@pixi/sprite-tiling": "^7.4.2",
|
47
|
+
"@pixi/text": "^7.4.2",
|
48
|
+
"@pixi/ticker": "^7.4.2",
|
49
|
+
"@pixi/utils": "^7.4.2"
|
50
50
|
},
|
51
51
|
"peerDependencies": {
|
52
|
-
"@crispcode/modux": "^5.1.
|
52
|
+
"@crispcode/modux": "^5.1.6"
|
53
53
|
},
|
54
54
|
"devDependencies": {
|
55
55
|
"esdoc": "^1.1.0",
|
package/scripts/button.js
CHANGED
@@ -18,7 +18,7 @@ export class Button extends Element {
|
|
18
18
|
* Marks the Button as interactive
|
19
19
|
* @type {Boolean}
|
20
20
|
*/
|
21
|
-
this.
|
21
|
+
this.eventMode = 'static'
|
22
22
|
/**
|
23
23
|
* Marks the Button as a button
|
24
24
|
* @type {Boolean}
|
@@ -86,10 +86,10 @@ export class Button extends Element {
|
|
86
86
|
enable ( enabled ) {
|
87
87
|
this.__enabled = !!enabled
|
88
88
|
if ( enabled ) {
|
89
|
-
this.
|
89
|
+
this.eventMode = 'static'
|
90
90
|
this.buttonMode = true
|
91
91
|
} else {
|
92
|
-
this.
|
92
|
+
this.eventMode = 'auto'
|
93
93
|
this.buttonMode = false
|
94
94
|
}
|
95
95
|
}
|
package/scripts/controls.js
CHANGED
@@ -1,12 +1,16 @@
|
|
1
1
|
'use strict'
|
2
2
|
|
3
|
+
import { EventBoundary } from "@pixi/events"
|
4
|
+
|
3
5
|
export class Controls {
|
4
6
|
/**
|
5
7
|
* The pixi application renderer
|
6
8
|
* @param {Renderer} renderer
|
9
|
+
* @param {DisplayObject} stage
|
7
10
|
*/
|
8
|
-
constructor ( renderer ) {
|
11
|
+
constructor ( renderer, stage ) {
|
9
12
|
this.__renderer = renderer
|
13
|
+
this.__stage = stage
|
10
14
|
this.__listeners = []
|
11
15
|
}
|
12
16
|
|
@@ -26,8 +30,9 @@ export class Controls {
|
|
26
30
|
* @returns {DisplayObject}
|
27
31
|
*/
|
28
32
|
__getTarget ( x, y ) {
|
29
|
-
|
30
|
-
|
33
|
+
const boundary = new EventBoundary(this.__stage);
|
34
|
+
let target = boundary.hitTest(x, y);
|
35
|
+
if ( target && target.eventMode == 'static' ) {
|
31
36
|
return target
|
32
37
|
}
|
33
38
|
return null
|
@@ -39,7 +44,7 @@ export class Controls {
|
|
39
44
|
enableWheel () {
|
40
45
|
let onPush = ( e ) => {
|
41
46
|
let target = this.__getTarget( e.offsetX, e.offsetY )
|
42
|
-
if ( target && target.
|
47
|
+
if ( target && target.eventMode == 'static' ) {
|
43
48
|
target.emit( this.__getEventName( 'wheel' ), e )
|
44
49
|
}
|
45
50
|
}
|
@@ -57,7 +62,7 @@ export class Controls {
|
|
57
62
|
let onPush = ( e ) => {
|
58
63
|
let target = this.__getTarget( e.offsetX, e.offsetY )
|
59
64
|
let timeout = null
|
60
|
-
if ( target && target.
|
65
|
+
if ( target && target.eventMode == 'static' ) {
|
61
66
|
timeout = setTimeout( () => {
|
62
67
|
target.emit( this.__getEventName( 'longtap' ), e )
|
63
68
|
}, 700 )
|
package/scripts/shimmer.js
CHANGED
@@ -7,8 +7,7 @@ import { Component, extend, logger } from '@crispcode/modux'
|
|
7
7
|
import { autoDetectRenderer, BatchRenderer } from '@pixi/core'
|
8
8
|
import { Assets } from '@pixi/assets'
|
9
9
|
import { Ticker } from '@pixi/ticker'
|
10
|
-
import {
|
11
|
-
import { skipHello, isWebGLSupported } from '@pixi/utils'
|
10
|
+
import { isWebGLSupported } from '@pixi/utils'
|
12
11
|
import { extensions } from '@pixi/extensions'
|
13
12
|
|
14
13
|
// Canvas support
|
@@ -26,7 +25,6 @@ import '@pixi/canvas-text'
|
|
26
25
|
import { Element } from './element.js'
|
27
26
|
import { Controls } from './controls.js'
|
28
27
|
|
29
|
-
extensions.add( InteractionManager )
|
30
28
|
extensions.add( BatchRenderer )
|
31
29
|
|
32
30
|
/**
|
@@ -77,8 +75,6 @@ export class Shimmer extends Component {
|
|
77
75
|
constructor ( parent, module, store ) {
|
78
76
|
super( parent, module, store )
|
79
77
|
|
80
|
-
skipHello()
|
81
|
-
|
82
78
|
/**
|
83
79
|
* Stores the parent Element
|
84
80
|
* @type {Element}
|
@@ -164,8 +160,6 @@ export class Shimmer extends Component {
|
|
164
160
|
|
165
161
|
this.renderer.resize( this.element.clientWidth, this.element.clientHeight )
|
166
162
|
|
167
|
-
this.renderer.plugins.interaction.autoPreventDefault = false
|
168
|
-
|
169
163
|
if ( !isWebGLSupported() ) {
|
170
164
|
logger.warn( 'WebGL is not supported. Using Canvas fallback.' )
|
171
165
|
}
|
@@ -173,7 +167,7 @@ export class Shimmer extends Component {
|
|
173
167
|
/**
|
174
168
|
* Stores the controls class, responsible with implementing special gestures
|
175
169
|
*/
|
176
|
-
this.controls = new Controls( this.renderer )
|
170
|
+
this.controls = new Controls( this.renderer, this.stage )
|
177
171
|
this.controls.enableWheel()
|
178
172
|
this.controls.enableLongtap()
|
179
173
|
}
|
package/scripts/video.js
CHANGED
@@ -19,12 +19,12 @@ export class Video extends Element {
|
|
19
19
|
constructor ( source, options = {} ) {
|
20
20
|
super()
|
21
21
|
|
22
|
-
if ( typeof source
|
22
|
+
if ( typeof source !== Video ) {
|
23
23
|
this.__source = document.createElement( 'video' )
|
24
24
|
this.__source.playsInline = true
|
25
25
|
this.__source.preload = 'auto'
|
26
26
|
this.__source.autoplay = false
|
27
|
-
this.__source.muted = ( options.muted !== undefined ) ? options.muted :
|
27
|
+
this.__source.muted = ( options.muted !== undefined ) ? options.muted : true
|
28
28
|
this.__source.loop = ( options.loop !== undefined ) ? options.loop : true
|
29
29
|
this.__source.src = source
|
30
30
|
} else {
|
package/test/app.html
CHANGED
@@ -12,8 +12,6 @@
|
|
12
12
|
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
|
13
13
|
<meta name="apple-mobile-web-app-title" content="Open the Box">
|
14
14
|
|
15
|
-
<script crossorigin="anonymous" src="https://polyfill.io/v3/polyfill.min.js?flags=gated&features=default%2CMutationObserver%2CString.prototype.padStart%2Cconsole.info"></script>
|
16
|
-
|
17
15
|
<base href="/" />
|
18
16
|
|
19
17
|
<link rel="stylesheet" href="app.min.css" />
|
@@ -33,17 +33,15 @@ export class Moon extends Element {
|
|
33
33
|
|
34
34
|
this.__rotating = false
|
35
35
|
|
36
|
-
this.
|
36
|
+
this.eventMode = 'static'
|
37
37
|
|
38
38
|
this.on( 'wheel', ( e ) => {
|
39
|
-
e.preventDefault()
|
40
39
|
let scale = Math.max( 0.2, Math.min( this.scale.x, this.scale.y ) + e.deltaY / -100 )
|
41
40
|
this.scale.set( scale )
|
42
|
-
}
|
41
|
+
})
|
43
42
|
this.on( 'longtap', ( e ) => {
|
44
|
-
e.preventDefault()
|
45
43
|
this.scale.set( 1 )
|
46
|
-
}
|
44
|
+
})
|
47
45
|
}
|
48
46
|
|
49
47
|
__move () {
|