main
Last change
on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
1.2 KB
|
Rev | Line | |
---|
[d565449] | 1 | import 'tslib';
|
---|
| 2 |
|
---|
| 3 | var getTileTouchPoint = function (draggingTile, targetTile, absolutePosition, _a) {
|
---|
| 4 | var elementHeight = _a.elementHeight, elementWidth = _a.elementWidth, activeBorderSize = _a.activeBorderSize;
|
---|
| 5 | var position = {
|
---|
| 6 | x: absolutePosition.x - targetTile.col * elementWidth,
|
---|
| 7 | y: absolutePosition.y - targetTile.row * elementHeight,
|
---|
| 8 | };
|
---|
| 9 | if (draggingTile.col >= targetTile.col && position.x < activeBorderSize)
|
---|
| 10 | return 'left';
|
---|
| 11 | if (draggingTile.col <= targetTile.col &&
|
---|
| 12 | position.x > elementWidth * targetTile.colSpan - activeBorderSize)
|
---|
| 13 | return 'right';
|
---|
| 14 | if (draggingTile.row <= targetTile.row &&
|
---|
| 15 | position.y > elementHeight * targetTile.rowSpan - activeBorderSize)
|
---|
| 16 | return 'bottom';
|
---|
| 17 | if (draggingTile.row >= targetTile.row && position.y < activeBorderSize)
|
---|
| 18 | return 'top';
|
---|
| 19 | if (position.x > activeBorderSize &&
|
---|
| 20 | position.y < elementWidth * targetTile.colSpan - activeBorderSize &&
|
---|
| 21 | position.y > activeBorderSize &&
|
---|
| 22 | position.y < elementHeight * targetTile.rowSpan - activeBorderSize)
|
---|
| 23 | return 'center';
|
---|
| 24 | };
|
---|
| 25 |
|
---|
| 26 | export { getTileTouchPoint };
|
---|
| 27 | //# sourceMappingURL=tiles.js.map
|
---|
Note:
See
TracBrowser
for help on using the repository browser.