Working on stacked buttons.
This commit is contained in:
+18
-62
@@ -28,10 +28,7 @@ class FullscreenInteractionManager extends PIXI.interaction.InteractionManager {
|
||||
let dy = 0
|
||||
let canvas = this.renderer.view
|
||||
let context = canvas.getContext('webgl')
|
||||
if (
|
||||
context.drawingBufferWidth < canvas.width ||
|
||||
context.drawingBufferHeight < canvas.height
|
||||
) {
|
||||
if (context.drawingBufferWidth < canvas.width || context.drawingBufferHeight < canvas.height) {
|
||||
extendWidth = context.drawingBufferWidth / canvas.width
|
||||
extendHeight = context.drawingBufferHeight / canvas.height
|
||||
//dx = wantedWidth - context.drawingBufferWidth
|
||||
@@ -143,10 +140,7 @@ export default class PIXIApp extends PIXI.Application {
|
||||
console.log('App is in fullScreen mode or autoResize mode')
|
||||
const resizeDebounced = debounce(event => this.resize(event), 50)
|
||||
window.addEventListener('resize', resizeDebounced)
|
||||
document.body.addEventListener(
|
||||
'orientationchange',
|
||||
this.checkOrientation.bind(this)
|
||||
)
|
||||
document.body.addEventListener('orientationchange', this.checkOrientation.bind(this))
|
||||
}
|
||||
if (monkeyPatchMapping) {
|
||||
console.log('Using monkey patched coordinate mapping')
|
||||
@@ -177,18 +171,12 @@ export default class PIXIApp extends PIXI.Application {
|
||||
uri: '/graphql'
|
||||
})
|
||||
|
||||
const wsClient = new subscriptions.SubscriptionClient(
|
||||
`wss://${location.hostname}/subscriptions`,
|
||||
{
|
||||
reconnect: true,
|
||||
connectionParams: {}
|
||||
}
|
||||
)
|
||||
const wsClient = new subscriptions.SubscriptionClient(`wss://${location.hostname}/subscriptions`, {
|
||||
reconnect: true,
|
||||
connectionParams: {}
|
||||
})
|
||||
|
||||
const networkInterfaceWithSubscriptions = subscriptions.addGraphQLSubscriptions(
|
||||
networkInterface,
|
||||
wsClient
|
||||
)
|
||||
const networkInterfaceWithSubscriptions = subscriptions.addGraphQLSubscriptions(networkInterface, wsClient)
|
||||
|
||||
this.apolloClient = new apollo.ApolloClient({
|
||||
networkInterface: networkInterfaceWithSubscriptions
|
||||
@@ -324,10 +312,7 @@ export default class PIXIApp extends PIXI.Application {
|
||||
* @param {number} [opts.height=window.innerHeight] - The height of the app to resize to.
|
||||
* @return {PIXIApp} - Returns the PIXIApp for chaining.
|
||||
*/
|
||||
resize(
|
||||
event,
|
||||
{ width = window.innerWidth, height = window.innerHeight } = {}
|
||||
) {
|
||||
resize(event, { width = window.innerWidth, height = window.innerHeight } = {}) {
|
||||
this.width = width
|
||||
this.height = height
|
||||
this.expandRenderer()
|
||||
@@ -348,8 +333,7 @@ export default class PIXIApp extends PIXI.Application {
|
||||
monkeyPatchPixiMapping() {
|
||||
if (this.originalMapPositionToPoint === null) {
|
||||
let interactionManager = this.renderer.plugins.interaction
|
||||
this.originalMapPositionToPoint =
|
||||
interactionManager.mapPositionToPoint
|
||||
this.originalMapPositionToPoint = interactionManager.mapPositionToPoint
|
||||
interactionManager.mapPositionToPoint = (point, x, y) => {
|
||||
return this.fixedMapPositionToPoint(point, x, y)
|
||||
}
|
||||
@@ -378,8 +362,7 @@ export default class PIXIApp extends PIXI.Application {
|
||||
|
||||
if (
|
||||
context !== null &&
|
||||
(context.drawingBufferWidth < canvas.width ||
|
||||
context.drawingBufferHeight < canvas.height)
|
||||
(context.drawingBufferWidth < canvas.width || context.drawingBufferHeight < canvas.height)
|
||||
) {
|
||||
extendWidth = context.drawingBufferWidth / canvas.width
|
||||
extendHeight = context.drawingBufferHeight / canvas.height
|
||||
@@ -388,12 +371,7 @@ export default class PIXIApp extends PIXI.Application {
|
||||
}
|
||||
x *= extendWidth
|
||||
y *= extendHeight
|
||||
return this.originalMapPositionToPoint.call(
|
||||
interactionManager,
|
||||
local,
|
||||
x,
|
||||
y + dy
|
||||
)
|
||||
return this.originalMapPositionToPoint.call(interactionManager, local, x, y + dy)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -444,9 +422,7 @@ export default class PIXIApp extends PIXI.Application {
|
||||
* @return {Modal} Returns the Modal object.
|
||||
*/
|
||||
modal(opts = {}) {
|
||||
let modal = new Modal(
|
||||
Object.assign({ theme: this.theme }, opts, { app: this })
|
||||
)
|
||||
let modal = new Modal(Object.assign({ theme: this.theme }, opts, { app: this }))
|
||||
this.scene.addChild(modal)
|
||||
|
||||
return modal
|
||||
@@ -459,9 +435,7 @@ export default class PIXIApp extends PIXI.Application {
|
||||
* @return {Message} Returns the Message object.
|
||||
*/
|
||||
message(opts = {}) {
|
||||
let message = new Message(
|
||||
Object.assign({ theme: this.theme }, opts, { app: this })
|
||||
)
|
||||
let message = new Message(Object.assign({ theme: this.theme }, opts, { app: this }))
|
||||
this.scene.addChild(message)
|
||||
|
||||
return message
|
||||
@@ -480,11 +454,7 @@ export default class PIXIApp extends PIXI.Application {
|
||||
* @param {boolean} [opts.progress=false] - Should a progress bar display the loading status?
|
||||
* @return {PIXIApp} The PIXIApp object for chaining.
|
||||
*/
|
||||
loadSprites(
|
||||
resources,
|
||||
loaded = null,
|
||||
{ resolutionDependent = true, progress = false } = {}
|
||||
) {
|
||||
loadSprites(resources, loaded = null, { resolutionDependent = true, progress = false } = {}) {
|
||||
this.loadTextures(
|
||||
resources,
|
||||
textures => {
|
||||
@@ -517,11 +487,7 @@ export default class PIXIApp extends PIXI.Application {
|
||||
* @param {boolean} [opts.progress=false] - Should a progress bar display the loading status?
|
||||
* @return {PIXIApp} The PIXIApp object for chaining.
|
||||
*/
|
||||
loadTextures(
|
||||
resources,
|
||||
loaded = null,
|
||||
{ resolutionDependent = true, progress = false } = {}
|
||||
) {
|
||||
loadTextures(resources, loaded = null, { resolutionDependent = true, progress = false } = {}) {
|
||||
if (!Array.isArray(resources)) {
|
||||
resources = [resources]
|
||||
}
|
||||
@@ -534,16 +500,10 @@ export default class PIXIApp extends PIXI.Application {
|
||||
let resolution = Math.round(this.renderer.resolution)
|
||||
switch (resolution) {
|
||||
case 2:
|
||||
loader.add(
|
||||
resource,
|
||||
resource.replace(/\.([^.]*)$/, '@2x.$1')
|
||||
)
|
||||
loader.add(resource, resource.replace(/\.([^.]*)$/, '@2x.$1'))
|
||||
break
|
||||
case 3:
|
||||
loader.add(
|
||||
resource,
|
||||
resource.replace(/\.([^.]*)$/, '@3x.$1')
|
||||
)
|
||||
loader.add(resource, resource.replace(/\.([^.]*)$/, '@3x.$1'))
|
||||
break
|
||||
default:
|
||||
loader.add(resource)
|
||||
@@ -708,11 +668,7 @@ export default class PIXIApp extends PIXI.Application {
|
||||
pixiGlobal.x *= resolution
|
||||
pixiGlobal.y *= resolution
|
||||
// console.log("app.convertPointFromNodeToPage", pixiGlobal)
|
||||
return window.convertPointFromNodeToPage(
|
||||
app.view,
|
||||
pixiGlobal.x,
|
||||
pixiGlobal.y
|
||||
)
|
||||
return window.convertPointFromNodeToPage(app.view, pixiGlobal.x, pixiGlobal.y)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user