@wildebeest/boxlayout
Advanced tools
Comparing version 0.4.4 to 0.4.5
@@ -11,8 +11,3 @@ "use strict"; | ||
var binding = new PixelsBinding_1.PixelsBinding(element, this.config[i].elementProperty); | ||
if (this.config[i].inverse) { | ||
this.config[i].position.bindInverse(binding); | ||
} | ||
else { | ||
this.config[i].position.bind(binding); | ||
} | ||
this.config[i].position.bind(binding); | ||
} | ||
@@ -19,0 +14,0 @@ }; |
import { Block } from "./Block"; | ||
import { BlockBlueprint } from "./BlockBlueprint"; | ||
import { AbsolutePosition } from "../position/AbsolutePosition"; | ||
export declare class HorizontalBlock implements Block { | ||
protected blueprint: BlockBlueprint; | ||
constructor(left: Position, right: Position, top: Position); | ||
constructor(left: AbsolutePosition, right: AbsolutePosition, top: AbsolutePosition); | ||
bind(element: HTMLElement): void; | ||
} |
@@ -12,4 +12,3 @@ "use strict"; | ||
elementProperty: 'style.right', | ||
position: right, | ||
inverse: true | ||
position: right | ||
}, { | ||
@@ -16,0 +15,0 @@ elementProperty: 'style.top', |
import { Block } from "./Block"; | ||
import { BlockBlueprint } from "./BlockBlueprint"; | ||
import { AbsolutePosition } from "../position/AbsolutePosition"; | ||
export declare class RecktangleBlock implements Block { | ||
protected blueprint: BlockBlueprint; | ||
constructor(top: Position, right: Position, bottom: Position, left: Position); | ||
constructor(top: AbsolutePosition, right: AbsolutePosition, bottom: AbsolutePosition, left: AbsolutePosition); | ||
bind(element: HTMLElement): void; | ||
} |
@@ -12,8 +12,6 @@ "use strict"; | ||
elementProperty: 'style.right', | ||
position: right, | ||
inverse: true | ||
position: right | ||
}, { | ||
elementProperty: 'style.bottom', | ||
position: bottom, | ||
inverse: true | ||
position: bottom | ||
}, { | ||
@@ -20,0 +18,0 @@ elementProperty: 'style.left', |
import { Block } from "./Block"; | ||
import { BlockBlueprint } from "./BlockBlueprint"; | ||
import { AbsolutePosition } from "../position/AbsolutePosition"; | ||
export declare class VerticalBlock implements Block { | ||
protected blueprint: BlockBlueprint; | ||
constructor(top: Position, bottom: Position, left: Position); | ||
constructor(top: AbsolutePosition, bottom: AbsolutePosition, left: AbsolutePosition); | ||
bind(element: HTMLElement): void; | ||
} |
@@ -12,4 +12,3 @@ "use strict"; | ||
elementProperty: 'style.bottom', | ||
position: bottom, | ||
inverse: true | ||
position: bottom | ||
}, { | ||
@@ -16,0 +15,0 @@ elementProperty: 'style.left', |
@@ -24,2 +24,3 @@ "use strict"; | ||
var VerticalDeviderBuilder_1 = require("./VerticalDeviderBuilder"); | ||
var InverseValue_1 = require("./position/InverseValue"); | ||
var BoxLayout = (function () { | ||
@@ -50,10 +51,10 @@ function BoxLayout(emitterService, viewportService, horizontalBuilder, verticalBuilder, domService) { | ||
this.blueprints = { | ||
top: new RectangleBlock_1.RecktangleBlock(this.positions.screenTop, this.positions.screenRight, this.positions.top, this.positions.screenLeft), | ||
left: new RectangleBlock_1.RecktangleBlock(this.positions.top, this.positions.left, this.positions.screenBottom, this.positions.screenLeft), | ||
top: new RectangleBlock_1.RecktangleBlock(this.positions.screenTop, this.positions.screenRight, new InverseValue_1.InverseValue(this.positions.top), this.positions.screenLeft), | ||
left: new RectangleBlock_1.RecktangleBlock(this.positions.top, new InverseValue_1.InverseValue(this.positions.left), this.positions.screenBottom, this.positions.screenLeft), | ||
center: new RectangleBlock_1.RecktangleBlock(this.positions.top, this.positions.right, this.positions.bottom, this.positions.left), | ||
right: new RectangleBlock_1.RecktangleBlock(this.positions.top, this.positions.screenRight, this.positions.bottom, this.positions.right), | ||
bottom: new RectangleBlock_1.RecktangleBlock(this.positions.bottom, this.positions.screenRight, this.positions.screenBottom, this.positions.left), | ||
right: new RectangleBlock_1.RecktangleBlock(this.positions.top, this.positions.screenRight, this.positions.bottom, new InverseValue_1.InverseValue(this.positions.right)), | ||
bottom: new RectangleBlock_1.RecktangleBlock(new InverseValue_1.InverseValue(this.positions.bottom), this.positions.screenRight, this.positions.screenBottom, this.positions.left), | ||
deviderLeft: new VerticalBlock_1.VerticalBlock(this.positions.top, this.positions.screenBottom, this.positions.left), | ||
deviderRight: new VerticalBlock_1.VerticalBlock(this.positions.top, this.positions.bottom, this.positions.right), | ||
deviderBottom: new HorizontalBlock_1.HorizontalBlock(this.positions.left, this.positions.screenRight, this.positions.bottom) | ||
deviderRight: new VerticalBlock_1.VerticalBlock(this.positions.top, this.positions.bottom, new InverseValue_1.InverseValue(this.positions.right)), | ||
deviderBottom: new HorizontalBlock_1.HorizontalBlock(this.positions.left, this.positions.screenRight, new InverseValue_1.InverseValue(this.positions.bottom)) | ||
}; | ||
@@ -60,0 +61,0 @@ } |
{ | ||
"name": "@wildebeest/boxlayout", | ||
"version": "0.4.4", | ||
"version": "0.4.5", | ||
"description": "Box Layout module for creating fullscreen admin enviroments", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -18,9 +18,5 @@ import { Binding } from "../binding/Binding"; | ||
let binding: Binding = new PixelsBinding(element, this.config[i].elementProperty); | ||
if (this.config[i].inverse) { | ||
this.config[i].position.bindInverse(binding); | ||
} else { | ||
this.config[i].position.bind(binding); | ||
} | ||
this.config[i].position.bind(binding); | ||
} | ||
} | ||
} |
import { Block } from "./Block"; | ||
import { BlockBlueprint } from "./BlockBlueprint"; | ||
import { AbsolutePosition } from "../position/AbsolutePosition"; | ||
@@ -8,3 +9,3 @@ export class HorizontalBlock implements Block | ||
constructor(left: Position, right: Position, top: Position) | ||
constructor(left: AbsolutePosition, right: AbsolutePosition, top: AbsolutePosition) | ||
{ | ||
@@ -17,4 +18,3 @@ this.blueprint = new BlockBlueprint([ | ||
elementProperty: 'style.right', | ||
position: right, | ||
inverse: true | ||
position: right | ||
}, { | ||
@@ -21,0 +21,0 @@ elementProperty: 'style.top', |
import { Block } from "./Block"; | ||
import { BlockBlueprint } from "./BlockBlueprint"; | ||
import { AbsolutePosition } from "../position/AbsolutePosition"; | ||
@@ -8,3 +9,3 @@ export class RecktangleBlock implements Block | ||
constructor(top: Position, right: Position, bottom: Position, left: Position) | ||
constructor(top: AbsolutePosition, right: AbsolutePosition, bottom: AbsolutePosition, left: AbsolutePosition) | ||
{ | ||
@@ -17,8 +18,6 @@ this.blueprint = new BlockBlueprint([ | ||
elementProperty: 'style.right', | ||
position: right, | ||
inverse: true | ||
position: right | ||
}, { | ||
elementProperty: 'style.bottom', | ||
position: bottom, | ||
inverse: true | ||
position: bottom | ||
}, { | ||
@@ -25,0 +24,0 @@ elementProperty: 'style.left', |
import { Block } from "./Block"; | ||
import { BlockBlueprint } from "./BlockBlueprint"; | ||
import { AbsolutePosition } from "../position/AbsolutePosition"; | ||
@@ -8,3 +9,3 @@ export class VerticalBlock implements Block | ||
constructor(top: Position, bottom: Position, left: Position) | ||
constructor(top: AbsolutePosition, bottom: AbsolutePosition, left: AbsolutePosition) | ||
{ | ||
@@ -17,4 +18,3 @@ this.blueprint = new BlockBlueprint([ | ||
elementProperty: 'style.bottom', | ||
position: bottom, | ||
inverse: true | ||
position: bottom | ||
}, { | ||
@@ -21,0 +21,0 @@ elementProperty: 'style.left', |
@@ -12,2 +12,3 @@ import { injectable, inject } from "inversify"; | ||
import { VerticalDeviderBuilder } from "./VerticalDeviderBuilder"; | ||
import { InverseValue } from "./position/InverseValue"; | ||
@@ -50,10 +51,10 @@ @injectable() | ||
this.blueprints = { | ||
top: new RecktangleBlock(this.positions.screenTop, this.positions.screenRight, this.positions.top, this.positions.screenLeft), | ||
left: new RecktangleBlock(this.positions.top, this.positions.left, this.positions.screenBottom, this.positions.screenLeft), | ||
top: new RecktangleBlock(this.positions.screenTop, this.positions.screenRight, new InverseValue(this.positions.top), this.positions.screenLeft), | ||
left: new RecktangleBlock(this.positions.top, new InverseValue(this.positions.left), this.positions.screenBottom, this.positions.screenLeft), | ||
center: new RecktangleBlock(this.positions.top, this.positions.right, this.positions.bottom, this.positions.left), | ||
right: new RecktangleBlock(this.positions.top, this.positions.screenRight, this.positions.bottom, this.positions.right), | ||
bottom: new RecktangleBlock(this.positions.bottom, this.positions.screenRight, this.positions.screenBottom, this.positions.left), | ||
right: new RecktangleBlock(this.positions.top, this.positions.screenRight, this.positions.bottom, new InverseValue(this.positions.right)), | ||
bottom: new RecktangleBlock(new InverseValue(this.positions.bottom), this.positions.screenRight, this.positions.screenBottom, this.positions.left), | ||
deviderLeft: new VerticalBlock(this.positions.top, this.positions.screenBottom, this.positions.left), | ||
deviderRight: new VerticalBlock(this.positions.top, this.positions.bottom, this.positions.right), | ||
deviderBottom: new HorizontalBlock(this.positions.left, this.positions.screenRight, this.positions.bottom) | ||
deviderRight: new VerticalBlock(this.positions.top, this.positions.bottom, new InverseValue(this.positions.right)), | ||
deviderBottom: new HorizontalBlock(this.positions.left, this.positions.screenRight, new InverseValue(this.positions.bottom)) | ||
} | ||
@@ -60,0 +61,0 @@ } |
@@ -41,2 +41,15 @@ import 'ts-jest'; | ||
expect(object.value).toEqual(300); | ||
}); | ||
test("inverse binding", () => { | ||
object = { | ||
value: 0 | ||
}; | ||
let binding: Binding = new OneWayBinding(object, "value"); | ||
position = new PositionValue(0, 0, 100); | ||
position.bindInverse(binding); | ||
position.setMax(300); | ||
position.setValue(100); | ||
expect(object.value).toEqual(200); | ||
}); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
107366
122
1884