@ -30,6 +30,9 @@ export class PlanDisplayComponent implements AfterViewInit, OnInit {
rect? : Rect ;
bounds : any = { "left" : 0 , "top" : 0 , "right" : 0 , "bottom" : 0 , "position" : "css" } ;
@ViewChild ( "moveable" ) moveable? : NgxMoveableComponent ;
// slides: PlanElement[] = [];
slideIndex : number = 0 ;
zoneSlides? : CarouselComponent < PlanElement > ;
@ -39,8 +42,12 @@ export class PlanDisplayComponent implements AfterViewInit, OnInit {
init : boolean = false ;
hasAttachedOnce : boolean = false ;
constructor ( private events : EventsService , private configService : ConfigService , private cdr : ChangeDetectorRef , private shortcut : ShortcutService , public planService : PlanService , public worldAreaService : WorldAreaService , public overlayService : OverlayService , private zone : NgZone ) {
window . addEventListener ( "resize" , this . windowInitHandler . bind ( this ) ) ;
constructor ( private events : EventsService , public configService : ConfigService , private cdr : ChangeDetectorRef , private shortcut : ShortcutService , public planService : PlanService , public worldAreaService : WorldAreaService , public overlayService : OverlayService , private zone : NgZone ) {
window . addEventListener ( "resize" , ( ) = > {
this . zone . run ( ( ) = > {
this . windowInitHandler ( )
} )
} ) ;
// const test = this.events.listen<StateEvent>("OverlayStateChange").subscribe(event => {
// if (!this.hasAttachedOnce) {
@ -53,7 +60,6 @@ export class PlanDisplayComponent implements AfterViewInit, OnInit {
// });
appWindow . listen ( "entered" , ( entered ) = > {
console . log ( "entered" , entered ) ;
if ( this . planService . currentPlan ) {
const current = this . planService . currentPlan . current ;
const length = this . planService . currentPlan . plan . length ;
@ -82,7 +88,6 @@ export class PlanDisplayComponent implements AfterViewInit, OnInit {
}
transform() {
console . log ( "transform:" , ` translate( ${ this . rect ! . x } px, ${ this . rect ! . y } px) ` , "rect" , this . rect ) ;
return ` translate( ${ this . rect ! . x } px, ${ this . rect ! . y } px) ` ;
}
@ -99,23 +104,21 @@ export class PlanDisplayComponent implements AfterViewInit, OnInit {
key = this . planService . currentPlan ! . plan [ this . planService . currentPlan ! . current ] . area_key ;
}
const world_area = this . worldAreaMap ? . get ( key ) ;
console . log ( "waypoint: " , world_area ! . has_waypoint ) ;
return world_area ! . has_waypoint ;
}
ngAfterViewInit ( ) : void {
if ( window . innerWidth > 0 ) {
console . log ( "recalculating" ) ;
const cfgRect = this . configService . config . initialPlanWindowPosition ;
console . log ( "cfgrect" , cfgRect ) ;
console . log ( "window res" , window . innerWidth ) ;
console . log ( "window res" , window . innerHeight ) ;
this . rect = {
x : cfgRect.x * window . innerWidth ,
y : cfgRect.y * window . innerHeight ,
width : cfgRect.width * window . innerWidth ,
height : cfgRect.height * window . innerHeight ,
}
console . log ( "rect" , this . rect ) ;
this . moveable ? . updateRect ( ) ;
setTimeout ( ( ) = > this . cdr . detectChanges ( ) , 0 ) ;
this . init = true ;
@ -153,7 +156,6 @@ export class PlanDisplayComponent implements AfterViewInit, OnInit {
registerZoneSlides ( carousel : CarouselComponent < PlanElement > ) {
this . zoneSlides = carousel ;
console . log ( "zone slides" ) ;
}
registerCurrentSlides ( carousel : CarouselComponent < PlanElement > ) {
this . currentSlides = carousel ;
@ -202,6 +204,11 @@ export class PlanDisplayComponent implements AfterViewInit, OnInit {
noteSlide . ref . nativeElement . style . transform = ` scale(1, ${ scale } ) ` ;
}
settingsClick ( event : any ) {
this . settingsOpen = ! this . settingsOpen ;
event . stopPropagation ( ) ;
}
openDialog() {
from ( open ( {
multiple : false ,
@ -221,4 +228,10 @@ export class PlanDisplayComponent implements AfterViewInit, OnInit {
}
} ) ;
}
loadBasePlan() {
this . planService . loadBasePlan ( ) . subscribe ( plan = > {
this . planService . currentPlan = plan ;
} )
}
}