File tree Expand file tree Collapse file tree 3 files changed +20
-1
lines changed
Expand file tree Collapse file tree 3 files changed +20
-1
lines changed Original file line number Diff line number Diff line change 1111 <div id =" top-bar" >
1212 <button id =" save-button" class =" save-button" title =" Save" >Save</button >
1313 <button id =" load-button" class =" load-button" title =" Load" >Load</button >
14+ <button id =" pause-button" class =" load-button" title =" Pause" >Pause</button >
1415 <div id =" app-title" >GEduNet</div >
1516 </div >
1617 <div id =" bottom-screen" class =" row container" >
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ import {
1919 selectElement ,
2020} from "./types/viewportManager" ;
2121import { DataGraph } from "./types/graphs/datagraph" ;
22+ import { packetTicker } from "./types/packet" ;
2223
2324const WORLD_WIDTH = 10000 ;
2425const WORLD_HEIGHT = 10000 ;
@@ -348,5 +349,19 @@ export class RightBar {
348349 input . click ( ) ;
349350 } ;
350351
352+ const pauseButton = document . getElementById ( "pause-button" ) ;
353+ let paused = false ;
354+ pauseButton . onclick = ( ) => {
355+ paused = ! paused ;
356+ if ( paused ) {
357+ pauseButton . textContent = "Resume" ;
358+ packetTicker . stop ( ) ;
359+ } else {
360+ pauseButton . textContent = "Pause" ;
361+ packetTicker . start ( ) ;
362+ }
363+ } ;
364+ packetTicker . start ( ) ;
365+
351366 console . log ( "initialized!" ) ;
352367} ) ( ) ;
Original file line number Diff line number Diff line change 11import { Graphics , Ticker } from "pixi.js" ;
22import { Edge , Position } from "./edge" ;
33
4+ export const packetTicker = new Ticker ( ) ;
5+
46export class Packet extends Graphics {
57 speed : number ;
68 progress = 0 ;
@@ -27,7 +29,8 @@ export class Packet extends Graphics {
2729 this . currentPath = path ;
2830 this . currentEdge = this . currentPath . shift ( ) ;
2931 this . currentStart = start ;
30- Ticker . shared . add ( this . updateProgress , this ) ;
32+ // TODO: use global ticker, and add "shouldProgress" flag
33+ packetTicker . add ( this . updateProgress , this ) ;
3134 }
3235
3336 updateProgress ( ticker : Ticker ) {
You can’t perform that action at this time.
0 commit comments