@wildebeest/boxlayout
Advanced tools
Comparing version 0.4.5 to 0.4.6
@@ -25,2 +25,3 @@ "use strict"; | ||
var InverseValue_1 = require("./position/InverseValue"); | ||
var PositionValue_1 = require("./position/PositionValue"); | ||
var BoxLayout = (function () { | ||
@@ -41,10 +42,10 @@ function BoxLayout(emitterService, viewportService, horizontalBuilder, verticalBuilder, domService) { | ||
this.positions = { | ||
screenTop: new SceenVerticalPositionValue_1.ScreenVerticalPositionValue(0, viewportService), | ||
screenRight: new ScreenHorizontalPositionValue_1.ScreenHorizontalPositionValue(0, viewportService), | ||
screenBottom: new SceenVerticalPositionValue_1.ScreenVerticalPositionValue(0, viewportService), | ||
screenLeft: new ScreenHorizontalPositionValue_1.ScreenHorizontalPositionValue(0, viewportService), | ||
top: new SceenVerticalPositionValue_1.ScreenVerticalPositionValue(0, viewportService), | ||
right: new ScreenHorizontalPositionValue_1.ScreenHorizontalPositionValue(0, viewportService), | ||
bottom: new SceenVerticalPositionValue_1.ScreenVerticalPositionValue(0, viewportService), | ||
left: new ScreenHorizontalPositionValue_1.ScreenHorizontalPositionValue(0, viewportService) | ||
screenTop: new SceenVerticalPositionValue_1.ScreenVerticalPositionValue(new PositionValue_1.PositionValue(0, 0, viewportService.getHeight()), viewportService), | ||
screenRight: new ScreenHorizontalPositionValue_1.ScreenHorizontalPositionValue(new PositionValue_1.PositionValue(0, 0, viewportService.getWidth()), viewportService), | ||
screenBottom: new SceenVerticalPositionValue_1.ScreenVerticalPositionValue(new PositionValue_1.PositionValue(0, 0, viewportService.getHeight()), viewportService), | ||
screenLeft: new ScreenHorizontalPositionValue_1.ScreenHorizontalPositionValue(new PositionValue_1.PositionValue(0, 0, viewportService.getWidth()), viewportService), | ||
top: new SceenVerticalPositionValue_1.ScreenVerticalPositionValue(new PositionValue_1.PositionValue(0, 0, viewportService.getHeight()), viewportService), | ||
right: new ScreenHorizontalPositionValue_1.ScreenHorizontalPositionValue(new PositionValue_1.PositionValue(0, 0, viewportService.getWidth()), viewportService), | ||
bottom: new SceenVerticalPositionValue_1.ScreenVerticalPositionValue(new PositionValue_1.PositionValue(0, 0, viewportService.getHeight()), viewportService), | ||
left: new ScreenHorizontalPositionValue_1.ScreenHorizontalPositionValue(new PositionValue_1.PositionValue(0, 0, viewportService.getWidth()), viewportService) | ||
}; | ||
@@ -78,3 +79,3 @@ this.blueprints = { | ||
this.createDragableDevider(this.blueprints.deviderBottom, this.builers.horizontal).getEmitter().on('wbDrag', function (event) { | ||
_this.positions.bottom.moveBy(event.vertical); | ||
_this.positions.bottom.moveBy(-event.vertical); | ||
}); | ||
@@ -81,0 +82,0 @@ } |
import { Binding } from "../binding/Binding"; | ||
export interface AbsolutePosition { | ||
bind(binding: Binding): void; | ||
bindInverse(binding: Binding): void; | ||
setValue(value: number): void; | ||
@@ -6,0 +5,0 @@ moveBy(value: number): void; |
@@ -1,5 +0,16 @@ | ||
import { PositionValue } from "./PositionValue"; | ||
import { ViewportService } from "@wildebeest/common"; | ||
export declare class ScreenVerticalPositionValue extends PositionValue { | ||
constructor(value: number, viewportService: ViewportService); | ||
import { AbsolutePosition } from "./AbsolutePosition"; | ||
import { Binding } from "../binding/Binding"; | ||
export declare class ScreenVerticalPositionValue implements AbsolutePosition { | ||
protected position: AbsolutePosition; | ||
constructor(position: AbsolutePosition, viewportService: ViewportService); | ||
bind(binding: Binding): void; | ||
getMax(): number; | ||
getMin(): number; | ||
getValue(): number; | ||
moveBy(value: number): void; | ||
setMax(max: number): void; | ||
setMin(min: number): void; | ||
setValue(value: number): void; | ||
update(): void; | ||
} |
"use strict"; | ||
var __extends = (this && this.__extends) || (function () { | ||
var extendStatics = function (d, b) { | ||
extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
return extendStatics(d, b); | ||
}; | ||
return function (d, b) { | ||
extendStatics(d, b); | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
})(); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var PositionValue_1 = require("./PositionValue"); | ||
var ScreenVerticalPositionValue = (function (_super) { | ||
__extends(ScreenVerticalPositionValue, _super); | ||
function ScreenVerticalPositionValue(value, viewportService) { | ||
var _this = _super.call(this, value, 0, viewportService.getHeight()) || this; | ||
var ScreenVerticalPositionValue = (function () { | ||
function ScreenVerticalPositionValue(position, viewportService) { | ||
var _this = this; | ||
this.position = position; | ||
viewportService.getEmitter().on('change', function (event) { | ||
_this.setMax(event.vertical); | ||
}); | ||
return _this; | ||
} | ||
ScreenVerticalPositionValue.prototype.bind = function (binding) { | ||
this.position.bind(binding); | ||
}; | ||
ScreenVerticalPositionValue.prototype.getMax = function () { | ||
return this.position.getMax(); | ||
}; | ||
ScreenVerticalPositionValue.prototype.getMin = function () { | ||
return this.position.getMin(); | ||
}; | ||
ScreenVerticalPositionValue.prototype.getValue = function () { | ||
return this.position.getValue(); | ||
}; | ||
ScreenVerticalPositionValue.prototype.moveBy = function (value) { | ||
this.position.moveBy(value); | ||
}; | ||
ScreenVerticalPositionValue.prototype.setMax = function (max) { | ||
this.position.setMax(max); | ||
this.update(); | ||
}; | ||
ScreenVerticalPositionValue.prototype.setMin = function (min) { | ||
this.position.setMin(min); | ||
this.update(); | ||
}; | ||
ScreenVerticalPositionValue.prototype.setValue = function (value) { | ||
this.position.setValue(value); | ||
this.update(); | ||
}; | ||
ScreenVerticalPositionValue.prototype.update = function () { | ||
this.position.update(); | ||
}; | ||
return ScreenVerticalPositionValue; | ||
}(PositionValue_1.PositionValue)); | ||
}()); | ||
exports.ScreenVerticalPositionValue = ScreenVerticalPositionValue; | ||
//# sourceMappingURL=SceenVerticalPositionValue.js.map |
@@ -1,5 +0,16 @@ | ||
import { PositionValue } from "./PositionValue"; | ||
import { ViewportService } from "@wildebeest/common"; | ||
export declare class ScreenHorizontalPositionValue extends PositionValue { | ||
constructor(value: number, viewportService: ViewportService); | ||
import { AbsolutePosition } from "./AbsolutePosition"; | ||
import { Binding } from "../binding/Binding"; | ||
export declare class ScreenHorizontalPositionValue implements AbsolutePosition { | ||
protected position: AbsolutePosition; | ||
constructor(position: AbsolutePosition, viewportService: ViewportService); | ||
bind(binding: Binding): void; | ||
getMax(): number; | ||
getMin(): number; | ||
getValue(): number; | ||
moveBy(value: number): void; | ||
setMax(max: number): void; | ||
setMin(min: number): void; | ||
setValue(value: number): void; | ||
update(): void; | ||
} |
"use strict"; | ||
var __extends = (this && this.__extends) || (function () { | ||
var extendStatics = function (d, b) { | ||
extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
return extendStatics(d, b); | ||
}; | ||
return function (d, b) { | ||
extendStatics(d, b); | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
})(); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var PositionValue_1 = require("./PositionValue"); | ||
var ScreenHorizontalPositionValue = (function (_super) { | ||
__extends(ScreenHorizontalPositionValue, _super); | ||
function ScreenHorizontalPositionValue(value, viewportService) { | ||
var _this = _super.call(this, value, 0, viewportService.getWidth()) || this; | ||
var ScreenHorizontalPositionValue = (function () { | ||
function ScreenHorizontalPositionValue(position, viewportService) { | ||
var _this = this; | ||
this.position = position; | ||
viewportService.getEmitter().on('change', function (event) { | ||
_this.setMax(event.horizontal); | ||
}); | ||
return _this; | ||
} | ||
ScreenHorizontalPositionValue.prototype.bind = function (binding) { | ||
this.position.bind(binding); | ||
}; | ||
ScreenHorizontalPositionValue.prototype.getMax = function () { | ||
return this.position.getMax(); | ||
}; | ||
ScreenHorizontalPositionValue.prototype.getMin = function () { | ||
return this.position.getMin(); | ||
}; | ||
ScreenHorizontalPositionValue.prototype.getValue = function () { | ||
return this.position.getValue(); | ||
}; | ||
ScreenHorizontalPositionValue.prototype.moveBy = function (value) { | ||
this.position.moveBy(value); | ||
}; | ||
ScreenHorizontalPositionValue.prototype.setMax = function (max) { | ||
this.position.setMax(max); | ||
this.update(); | ||
}; | ||
ScreenHorizontalPositionValue.prototype.setMin = function (min) { | ||
this.position.setMin(min); | ||
this.update(); | ||
}; | ||
ScreenHorizontalPositionValue.prototype.setValue = function (value) { | ||
this.position.setValue(value); | ||
this.update(); | ||
}; | ||
ScreenHorizontalPositionValue.prototype.update = function () { | ||
this.position.update(); | ||
}; | ||
return ScreenHorizontalPositionValue; | ||
}(PositionValue_1.PositionValue)); | ||
}()); | ||
exports.ScreenHorizontalPositionValue = ScreenHorizontalPositionValue; | ||
//# sourceMappingURL=ScreenHorizontalPositionValue.js.map |
{ | ||
"name": "@wildebeest/boxlayout", | ||
"version": "0.4.5", | ||
"version": "0.4.6", | ||
"description": "Box Layout module for creating fullscreen admin enviroments", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -13,2 +13,3 @@ import { injectable, inject } from "inversify"; | ||
import { InverseValue } from "./position/InverseValue"; | ||
import { PositionValue } from "./position/PositionValue"; | ||
@@ -40,10 +41,10 @@ @injectable() | ||
this.positions = { | ||
screenTop: new ScreenVerticalPositionValue(0, viewportService), | ||
screenRight: new ScreenHorizontalPositionValue(0, viewportService), | ||
screenBottom: new ScreenVerticalPositionValue(0, viewportService), | ||
screenLeft: new ScreenHorizontalPositionValue(0, viewportService), | ||
top: new ScreenVerticalPositionValue(0, viewportService), | ||
right: new ScreenHorizontalPositionValue(0, viewportService), | ||
bottom: new ScreenVerticalPositionValue(0, viewportService), | ||
left: new ScreenHorizontalPositionValue(0, viewportService) | ||
screenTop: new ScreenVerticalPositionValue(new PositionValue(0 , 0, viewportService.getHeight()), viewportService), | ||
screenRight: new ScreenHorizontalPositionValue(new PositionValue(0 , 0, viewportService.getWidth()), viewportService), | ||
screenBottom: new ScreenVerticalPositionValue(new PositionValue(0 , 0, viewportService.getHeight()), viewportService), | ||
screenLeft: new ScreenHorizontalPositionValue(new PositionValue(0 , 0, viewportService.getWidth()), viewportService), | ||
top: new ScreenVerticalPositionValue(new PositionValue(0 , 0, viewportService.getHeight()), viewportService), | ||
right: new ScreenHorizontalPositionValue(new PositionValue(0 , 0, viewportService.getWidth()), viewportService), | ||
bottom: new ScreenVerticalPositionValue(new PositionValue(0 , 0, viewportService.getHeight()), viewportService), | ||
left: new ScreenHorizontalPositionValue(new PositionValue(0 , 0, viewportService.getWidth()), viewportService) | ||
}; | ||
@@ -81,3 +82,3 @@ | ||
this.createDragableDevider(this.blueprints.deviderBottom, this.builers.horizontal).getEmitter().on('wbDrag', (event: any) => { | ||
this.positions.bottom.moveBy(event.vertical); | ||
this.positions.bottom.moveBy(-event.vertical); | ||
}); | ||
@@ -84,0 +85,0 @@ } |
@@ -6,3 +6,2 @@ import { Binding } from "../binding/Binding"; | ||
bind(binding: Binding): void; | ||
bindInverse(binding: Binding): void; | ||
setValue(value: number): void; | ||
@@ -9,0 +8,0 @@ moveBy(value: number): void |
@@ -1,9 +0,12 @@ | ||
import { PositionValue } from "./PositionValue"; | ||
import { ViewportService } from "@wildebeest/common"; | ||
import { AbsolutePosition } from "./AbsolutePosition"; | ||
import { Binding } from "../binding/Binding"; | ||
export class ScreenVerticalPositionValue extends PositionValue | ||
export class ScreenVerticalPositionValue implements AbsolutePosition | ||
{ | ||
constructor(value: number, viewportService: ViewportService) | ||
protected position: AbsolutePosition; | ||
constructor(position: AbsolutePosition, viewportService: ViewportService) | ||
{ | ||
super(value, 0, viewportService.getHeight()); | ||
this.position = position; | ||
viewportService.getEmitter().on('change', (event: any) => { | ||
@@ -13,2 +16,50 @@ this.setMax(event.vertical); | ||
} | ||
bind(binding: Binding): void | ||
{ | ||
this.position.bind(binding); | ||
} | ||
getMax(): number | ||
{ | ||
return this.position.getMax(); | ||
} | ||
getMin(): number | ||
{ | ||
return this.position.getMin(); | ||
} | ||
getValue(): number | ||
{ | ||
return this.position.getValue(); | ||
} | ||
moveBy(value: number): void | ||
{ | ||
this.position.moveBy(value); | ||
} | ||
setMax(max: number): void | ||
{ | ||
this.position.setMax(max); | ||
this.update(); | ||
} | ||
setMin(min: number): void | ||
{ | ||
this.position.setMin(min); | ||
this.update(); | ||
} | ||
setValue(value: number): void | ||
{ | ||
this.position.setValue(value); | ||
this.update(); | ||
} | ||
update(): void | ||
{ | ||
this.position.update(); | ||
} | ||
} |
@@ -1,9 +0,12 @@ | ||
import { PositionValue } from "./PositionValue"; | ||
import { ViewportService } from "@wildebeest/common"; | ||
import { AbsolutePosition } from "./AbsolutePosition"; | ||
import { Binding } from "../binding/Binding"; | ||
export class ScreenHorizontalPositionValue extends PositionValue | ||
export class ScreenHorizontalPositionValue implements AbsolutePosition | ||
{ | ||
constructor(value: number, viewportService: ViewportService) | ||
protected position: AbsolutePosition; | ||
constructor(position: AbsolutePosition, viewportService: ViewportService) | ||
{ | ||
super(value, 0, viewportService.getWidth()); | ||
this.position = position; | ||
viewportService.getEmitter().on('change', (event: any) => { | ||
@@ -13,2 +16,50 @@ this.setMax(event.horizontal); | ||
} | ||
bind(binding: Binding): void | ||
{ | ||
this.position.bind(binding); | ||
} | ||
getMax(): number | ||
{ | ||
return this.position.getMax(); | ||
} | ||
getMin(): number | ||
{ | ||
return this.position.getMin(); | ||
} | ||
getValue(): number | ||
{ | ||
return this.position.getValue(); | ||
} | ||
moveBy(value: number): void | ||
{ | ||
this.position.moveBy(value); | ||
} | ||
setMax(max: number): void | ||
{ | ||
this.position.setMax(max); | ||
this.update(); | ||
} | ||
setMin(min: number): void | ||
{ | ||
this.position.setMin(min); | ||
this.update(); | ||
} | ||
setValue(value: number): void | ||
{ | ||
this.position.setValue(value); | ||
this.update(); | ||
} | ||
update(): void | ||
{ | ||
this.position.update(); | ||
} | ||
} |
@@ -41,15 +41,2 @@ 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); | ||
}); |
@@ -5,2 +5,3 @@ import 'ts-jest'; | ||
import { AbsolutePosition } from '../src/position/AbsolutePosition'; | ||
import { PositionValue } from '../src/position/PositionValue'; | ||
import { ScreenHorizontalPositionValue } from '../src/position/ScreenHorizontalPositionValue'; | ||
@@ -14,4 +15,4 @@ import { ScreenVerticalPositionValue } from '../src/position/SceenVerticalPositionValue'; | ||
test("screen resize", () => { | ||
let vertical: AbsolutePosition = new ScreenVerticalPositionValue(0, viewportService); | ||
let horizontal: AbsolutePosition = new ScreenHorizontalPositionValue(0, viewportService); | ||
let vertical: AbsolutePosition = new ScreenVerticalPositionValue(new PositionValue(0 , 0, viewportService.getHeight()), viewportService); | ||
let horizontal: AbsolutePosition = new ScreenHorizontalPositionValue(new PositionValue(0 , 0, viewportService.getWidth()), viewportService); | ||
@@ -18,0 +19,0 @@ viewportService.getEmitter().emit("change", { |
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
113246
2008