Working on stacked buttons.
This commit is contained in:
+7
-24
@@ -119,10 +119,7 @@ export default class Stylus extends PIXI.Graphics {
|
||||
let identifier = event.data.identifier
|
||||
if (typeof event.data.originalEvent.changedTouches !== 'undefined') {
|
||||
for (let touch of event.data.originalEvent.changedTouches) {
|
||||
if (
|
||||
touch.identifier === identifier &&
|
||||
touch.touchType === 'stylus'
|
||||
) {
|
||||
if (touch.identifier === identifier && touch.touchType === 'stylus') {
|
||||
this.tiltX = Angle.radian2degree(touch.azimuthAngle)
|
||||
this.tiltY = 90.0 - Angle.radian2degree(touch.altitudeAngle)
|
||||
return true
|
||||
@@ -142,10 +139,7 @@ export default class Stylus extends PIXI.Graphics {
|
||||
let identifier = event.data.identifier
|
||||
if (typeof event.data.originalEvent.changedTouches !== 'undefined') {
|
||||
for (let touch of event.data.originalEvent.changedTouches) {
|
||||
if (
|
||||
touch.identifier === identifier &&
|
||||
touch.pointerType === 'touch'
|
||||
) {
|
||||
if (touch.identifier === identifier && touch.pointerType === 'touch') {
|
||||
return true
|
||||
}
|
||||
}
|
||||
@@ -182,8 +176,7 @@ export default class Stylus extends PIXI.Graphics {
|
||||
this.tiltY += 5
|
||||
break
|
||||
}
|
||||
if (this.debug)
|
||||
console.log('keydown', e.keyCode, this.tiltX, this.tiltY)
|
||||
if (this.debug) console.log('keydown', e.keyCode, this.tiltX, this.tiltY)
|
||||
})
|
||||
|
||||
this.on('pointerdown', e => {
|
||||
@@ -197,15 +190,9 @@ export default class Stylus extends PIXI.Graphics {
|
||||
})
|
||||
|
||||
this.on('pointermove', e => {
|
||||
if (
|
||||
Events.isPointerDown(e.data.originalEvent) ||
|
||||
this.isStylusPointer(e) ||
|
||||
this.isStylusTouch(e)
|
||||
) {
|
||||
if (this.debug)
|
||||
console.log('pointermove', e, this.eventInside(e))
|
||||
if (this.eventInside(e) && this.singlePointer())
|
||||
this.moveStroke(this.toStroke(e))
|
||||
if (Events.isPointerDown(e.data.originalEvent) || this.isStylusPointer(e) || this.isStylusTouch(e)) {
|
||||
if (this.debug) console.log('pointermove', e, this.eventInside(e))
|
||||
if (this.eventInside(e) && this.singlePointer()) this.moveStroke(this.toStroke(e))
|
||||
}
|
||||
})
|
||||
this.on('pointerup', e => {
|
||||
@@ -320,11 +307,7 @@ export default class Stylus extends PIXI.Graphics {
|
||||
this.moveTo(start.x, start.y)
|
||||
for (let i = 1; i < stroke.length; i++) {
|
||||
let info = stroke[i]
|
||||
this.lineStyle(
|
||||
this.tiltToLineWidth(info.tiltY),
|
||||
info.color,
|
||||
this.colorAlpha
|
||||
)
|
||||
this.lineStyle(this.tiltToLineWidth(info.tiltY), info.color, this.colorAlpha)
|
||||
this.lineTo(info.x, info.y)
|
||||
}
|
||||
this.endFill()
|
||||
|
||||
Reference in New Issue
Block a user