Prettified all files.
This commit is contained in:
+30
-25
@@ -15,12 +15,11 @@ export class Command extends PIXI.Graphics {
|
||||
this.setup()
|
||||
}
|
||||
|
||||
setup() {
|
||||
}
|
||||
setup() {}
|
||||
|
||||
draw() {
|
||||
this.clear()
|
||||
var color = (this.selected) ? this.selectedColor : 0xFFFFFF
|
||||
var color = this.selected ? this.selectedColor : 0xffffff
|
||||
this.lineStyle(0)
|
||||
this.beginFill(color, 1)
|
||||
this.drawShape(this.shape)
|
||||
@@ -108,7 +107,6 @@ export class StopCommand extends Command {
|
||||
}
|
||||
|
||||
export class RecorderTools extends PIXI.Container {
|
||||
|
||||
constructor(renderer) {
|
||||
super(renderer)
|
||||
this.renderer = renderer
|
||||
@@ -122,7 +120,9 @@ export class RecorderTools extends PIXI.Container {
|
||||
setup(container) {
|
||||
// Since this delegate might shadow another delegate, we mus avoid
|
||||
// capturing PointerEvents.
|
||||
this.delegate = new InteractionMapper(container, this, { capturePointerEvents: false })
|
||||
this.delegate = new InteractionMapper(container, this, {
|
||||
capturePointerEvents: false
|
||||
})
|
||||
}
|
||||
|
||||
findTarget(event, local, global) {
|
||||
@@ -131,13 +131,21 @@ export class RecorderTools extends PIXI.Container {
|
||||
|
||||
setupToolbar() {
|
||||
this.toolbar = new PIXI.Graphics()
|
||||
this.record = new RecordCommand(this, 0xCC0000, new PIXI.Circle(0, 0, 16))
|
||||
this.play = new PlayCommand(this, 0x0000CC, new PIXI.Polygon(0, 16,
|
||||
32, 16 + 16,
|
||||
0, 16 + 32,
|
||||
0, 16))
|
||||
this.stop = new StopCommand(this, 0x0000CC,
|
||||
new PIXI.Rectangle(0, 0, 32, 32))
|
||||
this.record = new RecordCommand(
|
||||
this,
|
||||
0xcc0000,
|
||||
new PIXI.Circle(0, 0, 16)
|
||||
)
|
||||
this.play = new PlayCommand(
|
||||
this,
|
||||
0x0000cc,
|
||||
new PIXI.Polygon(0, 16, 32, 16 + 16, 0, 16 + 32, 0, 16)
|
||||
)
|
||||
this.stop = new StopCommand(
|
||||
this,
|
||||
0x0000cc,
|
||||
new PIXI.Rectangle(0, 0, 32, 32)
|
||||
)
|
||||
this.toolbar.addChild(this.record).position.set(44, 48)
|
||||
this.toolbar.addChild(this.play).position.set(44 + 44, 16)
|
||||
this.toolbar.addChild(this.stop).position.set(44 + 44 + 44 + 16, 32)
|
||||
@@ -149,7 +157,7 @@ export class RecorderTools extends PIXI.Container {
|
||||
var graphics = this.toolbar
|
||||
graphics.clear()
|
||||
graphics.beginFill(0x000000, 0.5)
|
||||
graphics.lineStyle(2, 0xFFFFFF, 1)
|
||||
graphics.lineStyle(2, 0xffffff, 1)
|
||||
graphics.drawRoundedRect(16, 16, 44 * 4 + 8, 64, 8)
|
||||
graphics.endFill()
|
||||
}
|
||||
@@ -175,7 +183,11 @@ export class RecorderTools extends PIXI.Container {
|
||||
|
||||
mapPositionToPoint(point) {
|
||||
let local = new PIXI.Point()
|
||||
this.renderer.plugins.interaction.mapPositionToPoint(local, point.x, point.y)
|
||||
this.renderer.plugins.interaction.mapPositionToPoint(
|
||||
local,
|
||||
point.x,
|
||||
point.y
|
||||
)
|
||||
return local
|
||||
}
|
||||
|
||||
@@ -184,8 +196,7 @@ export class RecorderTools extends PIXI.Container {
|
||||
}
|
||||
|
||||
capture(event) {
|
||||
if (typeof event.mouseDownSubstitute != 'undefined')
|
||||
return false
|
||||
if (typeof event.mouseDownSubstitute != 'undefined') return false
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -226,8 +237,7 @@ export class RecorderTools extends PIXI.Container {
|
||||
let local = this.extractLocal(event)
|
||||
if (this.toolbar.containsPoint(local)) {
|
||||
this.onPress(local)
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
this.recordEvent(event)
|
||||
this.updateTouchGraphics(interaction)
|
||||
}
|
||||
@@ -244,9 +254,9 @@ export class RecorderTools extends PIXI.Container {
|
||||
}
|
||||
let p = current.get(key)
|
||||
if (key == 'mouse') {
|
||||
graphics.beginFill(0xCC0000, 0.5)
|
||||
graphics.beginFill(0xcc0000, 0.5)
|
||||
} else {
|
||||
graphics.beginFill(0xCCCCCC, 0.5)
|
||||
graphics.beginFill(0xcccccc, 0.5)
|
||||
}
|
||||
graphics.drawCircle(p.x, p.y, 20)
|
||||
}
|
||||
@@ -256,7 +266,6 @@ export class RecorderTools extends PIXI.Container {
|
||||
}
|
||||
|
||||
export class AppTest extends PIXIApp {
|
||||
|
||||
constructor(canvas, container) {
|
||||
super({ view: canvas, backgroundColor: 0x000000 })
|
||||
this.container = container
|
||||
@@ -277,7 +286,3 @@ export class AppTest extends PIXIApp {
|
||||
return this
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user