import Geo from '../../geo';

export default class LabelOptions {

    constructor ({ offset, exceed, move_in_tile, keep_in_tile, buffer }) {
		Object.assign(this, {
            move_in_tile,
            keep_in_tile,
            offset,
            exceed,
            buffer
        });

        this.buffer = this.buffer || 4;
        this.buffer *= Geo.units_per_pixel;
        this.keep_in_tile = this.keep_in_tile || true;
        this.move_in_tile = this.move_in_tile || true;
        this.offset = this.offset || [0, 0];
        this.exceed = this.exceed || 30;
    }

}

@@ -139,156 +139,8 @@
 ) %7B%0A
-%09%09Object.assign(this, %7B%0A            move_in_tile,%0A            keep_in_tile,%0A            offset,%0A            exceed,%0A            buffer%0A        %7D);%0A%0A
     
@@ -152,31 +152,44 @@
 his.
+buffer = (
 buffer 
+!
 = 
-this.
+null) ? 
 buffer 
-%7C%7C
+:
  4;%0A
@@ -260,21 +260,41 @@
 _tile = 
-this.
+(keep_in_tile != null) ? 
 keep_in_
@@ -290,34 +290,33 @@
  ? keep_in_tile 
-%7C%7C
+:
  true;%0A        t
@@ -334,21 +334,41 @@
 _tile = 
-this.
+(move_in_tile != null) ? 
 move_in_
@@ -372,18 +372,17 @@
 in_tile 
-%7C%7C
+:
  true;%0A 
@@ -402,21 +402,16 @@
 ffset = 
-this.
 offset %7C
@@ -446,22 +446,35 @@
 d = 
-this.
+(exceed != null) ? 
 exceed 
-%7C%7C
+:
  30;

simplify and fix null behavior for label options