Add zone parsing
This commit is contained in:
		
							parent
							
								
									bef457b399
								
							
						
					
					
						commit
						6983454ce3
					
				| 
						 | 
				
			
			@ -3,7 +3,7 @@ export class Segment {
 | 
			
		|||
  width: number
 | 
			
		||||
  height: number
 | 
			
		||||
  bg: string | string[]
 | 
			
		||||
  zones: Zone[] = []
 | 
			
		||||
  zones: SegmentZone[] = []
 | 
			
		||||
  layers: SegmentLayer[] = []
 | 
			
		||||
 | 
			
		||||
  constructor(o: any) {
 | 
			
		||||
| 
						 | 
				
			
			@ -13,7 +13,7 @@ export class Segment {
 | 
			
		|||
    this.bg = o.backgroundColor
 | 
			
		||||
 | 
			
		||||
    for (let z of o.zones) {
 | 
			
		||||
      this.zones.push(new Zone(z))
 | 
			
		||||
      this.zones.push(new SegmentZone(z))
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    for (let l of o.layers) {
 | 
			
		||||
| 
						 | 
				
			
			@ -68,8 +68,19 @@ export class SegmentDecoration {
 | 
			
		|||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export class Zone {
 | 
			
		||||
export class SegmentZone {
 | 
			
		||||
  uuid: string
 | 
			
		||||
  points: [number, number][] = []
 | 
			
		||||
  type: 'solid'|'fluid'
 | 
			
		||||
  constructor(o: any) {
 | 
			
		||||
    // ???
 | 
			
		||||
    this.uuid = o.uuid
 | 
			
		||||
    this.points = o.points.map((v: any) => {
 | 
			
		||||
      return [v.x, v.y]
 | 
			
		||||
    })
 | 
			
		||||
    if (o.data.type === 'fluid') {
 | 
			
		||||
      this.type = o.data.type
 | 
			
		||||
    } else {
 | 
			
		||||
      this.type = 'solid'
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user