Skip to content

Commit

Permalink
Merge pull request #105 from discoverfinancial/device-layers-aaron
Browse files Browse the repository at this point in the history
Device layers aaron
  • Loading branch information
smithbk authored Sep 21, 2023
2 parents 2ec1b37 + 8b72078 commit 14bdb2d
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/layers/layers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,18 @@
* Licensed under MIT License. See License.txt in the project root for license information
*/
import { Node } from "../common/node";
import { PropertyBoolean } from "../common/props";
import { PropertyBoolean, PropertyStringSelectable } from "../common/props";

/**
* Accessibility layers.
* @category Layers
*/
export class Layers extends Node {

public static readonly DT_DESKTOP = "desktop";
public static readonly DT_TABLET = "tablet";
public static readonly DT_MOBILE = "mobile";

/** Color blind property */
public readonly colorBlind: PropertyBoolean;
/** Dyslexia property */
Expand All @@ -19,13 +23,19 @@ export class Layers extends Node {
public readonly motionSensitivity: PropertyBoolean;
/** All accessbility layer properties */
public readonly properties: PropertyBoolean[];
/** The device target property */
public readonly deviceTarget: PropertyStringSelectable;

constructor(parent: Node) {
super("layers", parent);
this.colorBlind = new PropertyBoolean("Color Blind", false, this, {defaultValue: false});
this.dyslexia = new PropertyBoolean("Dyslexia", false, this, {defaultValue: false});
this.motionSensitivity = new PropertyBoolean("Motion Sensitivity", false, this, {defaultValue: false});
this.properties = [this.colorBlind, this.dyslexia, this.motionSensitivity];
this.deviceTarget = new PropertyStringSelectable("Devices", true, this, {
selectables: [Layers.DT_DESKTOP, Layers.DT_TABLET, Layers.DT_MOBILE],
defaultValue: Layers.DT_DESKTOP,
});
}

public deserialize(obj: any) {
Expand All @@ -34,13 +44,15 @@ export class Layers extends Node {
this.colorBlind.deserialize(obj.colorBlind);
this.dyslexia.deserialize(obj.dyslexia);
this.motionSensitivity.deserialize(obj.motionSensitivity);
this.deviceTarget.deserialize(obj.deviceTarget);
}

public serialize(): any {
const obj: any = {};
obj.colorBlind = this.colorBlind.serialize();
obj.dyslexia = this.dyslexia.serialize();
obj.motionSensitivity = this.motionSensitivity.serialize();
obj.deviceTarget = this.deviceTarget.serialize();
return obj;
}
}

0 comments on commit 14bdb2d

Please sign in to comment.