|
@@ -1,3 +1,9 @@ |
|
|
|
|
|
/** @constant {string} */ |
|
|
|
|
|
WALLCOLOUR = "#111111"; |
|
|
|
|
|
|
|
|
|
|
|
/** @constant {number} */ |
|
|
|
|
|
WALLWIDTH = "4"; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* Add 'Convert to walls' button in Walls Layer Tools |
|
|
* Add 'Convert to walls' button in Walls Layer Tools |
|
|
* */ |
|
|
* */ |
|
@@ -6,10 +12,9 @@ Hooks.on('getSceneControlButtons', controls => { |
|
|
let walls = controls.find(e => e.name === "walls"); |
|
|
let walls = controls.find(e => e.name === "walls"); |
|
|
walls.tools.push( { |
|
|
walls.tools.push( { |
|
|
"name": "convert-to-draw", |
|
|
"name": "convert-to-draw", |
|
|
"icon": "fas fa-square", |
|
|
|
|
|
|
|
|
"icon": "far fa-square", |
|
|
"title": "Convert selected to Drawing", |
|
|
"title": "Convert selected to Drawing", |
|
|
"onclick": () => { |
|
|
|
|
|
console.log("Converting selected to drawing"); |
|
|
|
|
|
|
|
|
"onClick": () => { |
|
|
canvas.walls.controlled.forEach(function(wall) { |
|
|
canvas.walls.controlled.forEach(function(wall) { |
|
|
Drawing.create({ |
|
|
Drawing.create({ |
|
|
type: CONST.DRAWING_TYPES.POLYGON, |
|
|
type: CONST.DRAWING_TYPES.POLYGON, |
|
@@ -17,15 +22,16 @@ Hooks.on('getSceneControlButtons', controls => { |
|
|
x: 0, |
|
|
x: 0, |
|
|
y: 0, |
|
|
y: 0, |
|
|
height: 100, |
|
|
height: 100, |
|
|
strokeWidth: 4, |
|
|
|
|
|
strokeColor:"#FF0000", |
|
|
|
|
|
|
|
|
strokeWidth: WALLWIDTH, |
|
|
|
|
|
strokeColor: WALLCOLOUR, |
|
|
points: [ |
|
|
points: [ |
|
|
[wall.coords[0], wall.coords[1]], |
|
|
[wall.coords[0], wall.coords[1]], |
|
|
[wall.coords[2], wall.coords[3]] |
|
|
[wall.coords[2], wall.coords[3]] |
|
|
] |
|
|
] |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
console.log("Converted walls to Drawings"); |
|
|
|
|
|
|
|
|
ui.controls.controls.find(e => e.name === "walls").activeTool = "select"; |
|
|
|
|
|
ui.controls.render(); |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
}); |