import {Color} from 'flockn/types';
import EventMap from 'eventmap';
import TextureImage from 'flockn/texture/image';
import TextureLabel from 'flockn/texture/label';
import serializable from 'flockn/mixins/serializable';

class Texture extends EventMap {
  constructor() {
    super();

    // Set up dimensions
    this.width = 0;
    this.height = 0;

    // Set parent property
    this.parent = null;

    this.image = new TextureImage(this);
    this.label = new TextureLabel(this);

    this.backgroundColor = Color.transparent();

    // TODO: What to do when there is both an image and a label
    this.on('image-loaded', () => {
      this.width = this.image.width;
      this.height = this.image.height;
    });

    this.on('label-loaded', () => {
      this.width = this.label.width;
      this.height = this.label.height;
    });
  }
}

serializable(Texture);

export default Texture;

@@ -14,22 +14,18 @@
 %7D from '
-flockn
+..
 /types';
@@ -84,30 +84,17 @@
 e from '
-flockn/texture
+.
 /image';
@@ -124,22 +124,9 @@
 om '
-flockn/texture
+.
 /lab
@@ -160,14 +160,10 @@
 om '
-flockn
+..
 /mix

Update texture dependencies