generated from League-of-Foundry-Developers/FoundryVTT-Module-Template
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
3,254 additions
and
1,830 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,28 @@ | ||
/* globals | ||
canvas | ||
CONFIG | ||
*/ | ||
/* eslint no-unused-vars: ["error", { "argsIgnorePattern": "^_" }] */ | ||
|
||
// Patches for the BaseGrid class | ||
// Patches for BaseGrid class | ||
import { MODULE_ID } from "./const.js"; | ||
import { log } from "./util.js"; | ||
|
||
|
||
export const PATCHES = {}; | ||
PATCHES.BASIC = {}; | ||
|
||
/** | ||
* Mix BaseGrid.prototype._getRulerDestination | ||
* If the ruler is not snapped, then return the actual token position, adjusted for token dimensions. | ||
* Override BaseGrid.prototype._getRulerDestination. | ||
* Don't return the top left corner, so that the token stays on the path through | ||
* waypoints not at the center of the grid. | ||
* @param {Ray} ray The ray being moved along. | ||
* @param {Point} offset The offset of the ruler's origin relative to the token's position. | ||
* @param {Token} token The token placeable being moved. | ||
* @return {Point} | ||
*/ | ||
function _getRulerDestination(wrapped, ray, offset, token) { | ||
if ( canvas.controls.ruler._unsnap || ray.pathfinding ) return ray.B.add(offset); | ||
|
||
// We are moving from the token center, so add back 1/2 width/height to offset. | ||
if ( !canvas.controls.ruler._unsnappedOrigin ) { | ||
offset.x += canvas.scene.dimensions.size * 0.5; | ||
offset.y += canvas.scene.dimensions.size * 0.5; | ||
} | ||
return wrapped(ray, offset, token); | ||
function _getRulerDestination(ray, offset, _token) { | ||
log(`Offsetting destination for ${_token.name}`, { dest: ray.B, offset }); | ||
return ray.B.add(offset).roundDecimals(); | ||
} | ||
|
||
PATCHES.BASIC.MIXES = { _getRulerDestination }; | ||
PATCHES.BASIC.OVERRIDES = { _getRulerDestination }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.