Defines data types and utilities used in xslet packages.
Install
Install from npm
Executes following command to install this package from npm.
$ npm install --save @xslet/datatype
Load this package in a browser
<script src="xslet.datatype.min.js"></script>
Usage
Rect
var Rect = xslet.datatype.Rect;
Rect rect = Rect({ left: 10, top: 20, width: 100, height: 50 })
console.log(rect)
console.log(rect.right)
rect.top = 30
rect.bottom = 200
console.log(rect)
APIs
Rect
Represents a rectangle.
Each of .right
and .width
properties are calculated automatically with another properties and .left
.
As well as each of .bottom
and .height
properties are calculated automatically with another properties and .top
.
When .left
and .top
properties are changed, the rectangle is moved and .width
and .height
are not changed.
The unit of this value is not specified.
In xslet package, it would be determined by xslet.window.unitOfSize
.
Properties:
- .top {number} - The top position of this rectangle.
- .left {number} - The left position of this rectangle.
- .right {number} - The right position of this rectangle.
- .bottom {number} - The bottom position of this rectangle.
- .width {number} - The width position of this rectangle.
- .height {number} - The height position of this rectangle.
Constructor:
Behavior checks on browsers
Show this page: https://xslet.github.io/datatype/test.html.
License
Copyright (C) 2016-2019 Takayuki Sato
This program is free software under MIT License.
See the file LICENSE in this distribution for more details.