ソースを参照

Add hook to provide convert button in Wall tools

tags/0.0.1
bertieb 4年前
コミット
a5bd9df2fe
1個のファイルの変更31行の追加0行の削除
  1. +31
    -0
      scripts/wallconvert.js

+ 31
- 0
scripts/wallconvert.js ファイルの表示

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

読み込み中…
キャンセル
保存