1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | function arrayMove(array, from, to) {
|
4 | array = array.slice();
|
5 | array.splice(to < 0 ? array.length + to : to, 0, array.splice(from, 1)[0]);
|
6 | return array;
|
7 | }
|
8 | exports.arrayMove = arrayMove;
|
9 | function arrayRemove(array, index) {
|
10 | array = array.slice();
|
11 | array.splice(index, 1);
|
12 | return array;
|
13 | }
|
14 | exports.arrayRemove = arrayRemove;
|
15 | function getTranslateOffset(element) {
|
16 | var style = window.getComputedStyle(element);
|
17 | return (Math.max(parseInt(style['margin-top'], 10), parseInt(style['margin-bottom'], 10)) + element.getBoundingClientRect().height);
|
18 | }
|
19 | exports.getTranslateOffset = getTranslateOffset;
|
20 | function transformItem(element, offsetY, offsetX) {
|
21 | if (offsetY === void 0) { offsetY = 0; }
|
22 | if (offsetX === void 0) { offsetX = 0; }
|
23 | if (offsetY === null || offsetX === null) {
|
24 | element.style.transform = null;
|
25 | return;
|
26 | }
|
27 | element.style.transform = "translate3d(" + offsetX + "px, " + offsetY + "px, 0px)";
|
28 | }
|
29 | exports.transformItem = transformItem;
|
30 | function isItemTransformed(element) {
|
31 | return !!element.style.transform;
|
32 | }
|
33 | exports.isItemTransformed = isItemTransformed;
|
34 | function setItemTransition(element, duration) {
|
35 | element.style['transition-duration'] = duration + "ms";
|
36 | }
|
37 | exports.setItemTransition = setItemTransition;
|
38 | function binarySearch(array, targetValue) {
|
39 | var min = 0;
|
40 | var max = array.length - 1;
|
41 | var guess;
|
42 | while (min <= max) {
|
43 | guess = Math.floor((max + min) / 2);
|
44 | if (!array[guess + 1] ||
|
45 | (array[guess] <= targetValue && array[guess + 1] >= targetValue)) {
|
46 | return guess;
|
47 | }
|
48 | else if (array[guess] < targetValue && array[guess + 1] < targetValue) {
|
49 | min = guess + 1;
|
50 | }
|
51 | else {
|
52 | max = guess - 1;
|
53 | }
|
54 | }
|
55 | return -1;
|
56 | }
|
57 | exports.binarySearch = binarySearch;
|