(length, tileSize, cameraOffset, order)
| 88 | } |
| 89 | |
| 90 | const getOffsets = (length, tileSize, cameraOffset, order) => { |
| 91 | const siblingCount = (length - tileSize) / tileSize |
| 92 | |
| 93 | // Do not add offset for very small fraction of tile |
| 94 | if (Math.abs(siblingCount) < 0.001) { |
| 95 | return [0, 0] |
| 96 | } |
| 97 | |
| 98 | const prev = siblingCount / 2 + 0.5 - cameraOffset |
| 99 | const next = siblingCount - prev |
| 100 | |
| 101 | let result = [-1 * Math.ceil(prev), Math.ceil(next)] |
| 102 | if (order === -1) { |
| 103 | result = [-1 * Math.ceil(next), Math.ceil(prev)] |
| 104 | } |
| 105 | return result |
| 106 | } |
| 107 | |
| 108 | const getTileOffsets = (length, tileSize, camera, order) => { |
| 109 | const cameraOffset = camera - Math.floor(camera) |
no outgoing calls
no test coverage detected