Bläddra i källkod

Add hook to provide convert button in Wall tools

tags/0.0.1
bertieb 4 år sedan
förälder
incheckning
a5bd9df2fe
1 ändrade filer med 31 tillägg och 0 borttagningar
  1. +31
    -0
      scripts/wallconvert.js

+ 31
- 0
scripts/wallconvert.js Visa fil

@@ -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");
}
});
});

Laddar…
Avbryt
Spara