Browse Source

Add hook to provide convert button in Wall tools

tags/0.0.1
bertieb 3 years ago
parent
commit
a5bd9df2fe
1 changed files with 31 additions and 0 deletions
  1. +31
    -0
      scripts/wallconvert.js

+ 31
- 0
scripts/wallconvert.js View File

@@ -0,0 +1,31 @@
/**
* Add 'Convert to walls' button in Walls Layer Tools
* */

Hooks.on('getSceneControlButtons', controls => {
let walls = controls.find(e => e.name === "walls");
walls.tools.push( {
"name": "convert-to-draw",
"icon": "fas fa-square",
"title": "Convert selected to Drawing",
"onclick": () => {
console.log("Converting selected to drawing");
canvas.walls.controlled.forEach(function(wall) {
Drawing.create({
type: CONST.DRAWING_TYPES.POLYGON,
author: game.user._id,
x: 0,
y: 0,
height: 100,
strokeWidth: 4,
strokeColor:"#FF0000",
points: [
[wall.coords[0], wall.coords[1]],
[wall.coords[2], wall.coords[3]]
]
});
});
console.log("Converted walls to Drawings");
}
});
});

Loading…
Cancel
Save