Skip to content

Commit

Permalink
2.1.4
Browse files Browse the repository at this point in the history
- Fixed conflict with Pick-Up-Stix module.
  • Loading branch information
wsaunders1014 committed Sep 13, 2020
1 parent cc9d965 commit f72791e
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 22 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ New Settings:
You can now point to where the speed or movement attribute is located on the actor sheet. For instance, for DnD5e it is `actor.data.data.attributes.speed.value`. You can also point to a bonus movement attribute if your system has one. In addition you can use token.setFlag('ShowDragDistance','speed',{normal:0,dash:0}) to add any one time speed boosts via macro. The DragRuler also calls Hook.call('moveToken', token, dragRuler) when the token moves. Drag colors are configurable in client side settings if they are too close to player's color.

# Changelog
2.1.4 - Fixed conflict with Pick-Up-Stix.

2.1.3 - Fixed user broadcasting.

2.1.2 - DragRuler no longer shows for GM movements, unless the GM holds down 'Alt' to broadcast. If your movement speed uses decimals, it will now work properly. You can now also press 'P' to place a waypoint while dragging if you're on a touchpad.
Expand Down
4 changes: 2 additions & 2 deletions module.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"title": "Show Drag Distance",
"description": "Shows the distance you're dragging a token, similar to holding the ctrl key. Because 30 feet isn't as much as it sounds. Also removes the contraint of the normal ruler to hold CTRL and drag from Token. Now you can just press CTRL with token selected and it will show you the range from your token to mouse!",
"authors": [{"name":"Will Saunders","email":"[email protected]" }],
"version": "2.1.3",
"version": "2.1.4",
"minimumCoreVersion": "0.6.2",
"compatibleCoreVersion":"0.6.6",
"scripts": [
Expand All @@ -24,5 +24,5 @@
"changelog":"https://raw.githubusercontent.com/wsaunders1014/ShowDragDistance/master/README.md",
"url":"https://github.com/wsaunders1014/ShowDragDistance",
"manifest":"https://raw.githubusercontent.com/wsaunders1014/ShowDragDistance/master/module.json",
"download":"https://github.com/wsaunders1014/ShowDragDistance/releases/download/2.1.3/ShowDragDistance.zip"
"download":"https://github.com/wsaunders1014/ShowDragDistance/releases/download/2.1.4/ShowDragDistance.zip"
}
45 changes: 25 additions & 20 deletions showdragdistance.js
Original file line number Diff line number Diff line change
Expand Up @@ -513,13 +513,13 @@ class DragRuler extends Ruler{

let oldOnDragLeftStart = Token.prototype._onDragLeftStart;
Token.prototype._onDragLeftStart = function(event){
if(game.settings.get('ShowDragDistance','enabled') === true)
if(game.settings.get('ShowDragDistance','enabled') === true && typeof this.data.flags['pick-up-stix'] == 'undefined')
canvas.controls.dragRuler._onDragStart(event)
oldOnDragLeftStart.apply(this,[event])
}
let oldOnDragLeftMove = Token.prototype._onDragLeftMove;
Token.prototype._onDragLeftMove = function(event){
if(canvas.controls.dragRuler.active){
if(canvas.controls.dragRuler.active && typeof this.data.flags['pick-up-stix'] == 'undefined'){
canvas.controls.dragRuler._onMouseMove(event,this)

if(!this.data.hidden && game.user.isGM && altPressed){
Expand Down Expand Up @@ -550,12 +550,12 @@ class DragRuler extends Ruler{
this.layer.preview.removeChildren();


if(canvas.controls.dragRuler.active){
if(canvas.controls.dragRuler.active && typeof this.data.flags['pick-up-stix'] == 'undefined'){
const dragruler = (canvas.controls.dragRuler._state > 0) ? canvas.controls.dragRuler.toJSON() : null;
canvas.controls.dragRuler.moveToken()

}else{
//oldOnDragLeftCancel.apply(this,[event])
oldOnDragLeftCancel.apply(this,[event])
}
}else{
oldOnDragLeftCancel.apply(this,[event])
Expand All @@ -564,22 +564,27 @@ class DragRuler extends Ruler{
}
let handleDragCancel = MouseInteractionManager.prototype._handleDragCancel;
MouseInteractionManager.prototype._handleDragCancel = function(event){
if(canvas.tokens.controlled.length > 0 && canvas.tokens.controlled[0].mouseInteractionManager.state == 3){
switch(event.button){
case 0:

handleDragCancel.apply(this,[event])
break;
case 2:
canvas.controls.dragRuler._addWaypoint(canvas.app.renderer.plugins.interaction.mouse.getLocalPosition(canvas.tokens));
break;
default:
handleDragCancel.apply(this,[event])
break;
}
}else{
handleDragCancel.apply(this,[event])
}

if((typeof this.object.data != 'undefined') && typeof this.object.data.flags['pick-up-stix'] == 'undefined'){
if( canvas.tokens.controlled.length > 0 && canvas.tokens.controlled[0].mouseInteractionManager.state == 3 ){
switch(event.button){
case 0:

handleDragCancel.apply(this,[event])
break;
case 2:
canvas.controls.dragRuler._addWaypoint(canvas.app.renderer.plugins.interaction.mouse.getLocalPosition(canvas.tokens));
break;
default:
handleDragCancel.apply(this,[event])
break;
}
}else{
handleDragCancel.apply(this,[event])
}
}else{
handleDragCancel.apply(this,[event])
}
}
}
}
Expand Down

0 comments on commit f72791e

Please sign in to comment.