Skip to content

Commit

Permalink
Resolve brush tool preview not showing on initial selection of simple…
Browse files Browse the repository at this point in the history
…fog #78
  • Loading branch information
UranusBytes committed Sep 11, 2022
1 parent ca683d1 commit 08cb5ff
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion classes/SimplefogLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -284,8 +284,8 @@ export default class SimplefogLayer extends MaskLayer {
this.clearActiveTool();
this.activeTool = tool;
this.setPreviewTint();
simplefogLogVerboseDebug('SimplefogLayer.setActiveTool - HTML element', $('#simplefog-brush-controls #brush-size-container'))
const currentTool = $('#simplefog-brush-controls #brush-size-container')
simplefogLogVerboseDebug('SimplefogLayer.setActiveTool - HTML element', currentTool)
if (currentTool.length) {
if (tool === 'brush') {
this.ellipsePreview.visible = true;
Expand Down Expand Up @@ -332,6 +332,7 @@ export default class SimplefogLayer extends MaskLayer {
* Aborts any active drawing tools
*/
clearActiveTool() {
simplefogLogDebug('SimplefogLayer.clearActiveTool')
try {
// Box preview
this.boxPreview.visible = false;
Expand Down
3 changes: 3 additions & 0 deletions js/controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ Hooks.on('getSceneControlButtons', (controls) => {
Hooks.on('renderSceneControls', (controls) => {
simplefogLogDebug('controls.renderSceneControls')
simplefogLogVerboseDebug('controls.renderSceneControls - controls', controls)
simplefogLogVerboseDebug('controls.renderSceneControls - activeTool', controls.activeTool)
// Switching to layer
if (canvas.simplefog != null) {
simplefogLogVerboseDebug('controls.renderSceneControls - Switching', controls.activeControl, controls.activeTool)
Expand All @@ -132,11 +133,13 @@ Hooks.on('renderSceneControls', (controls) => {
* Sets Y position of the brush controls to account for scene navigation buttons
*/
function setBrushControlPos() {
simplefogLogDebug('controls.setBrushControlPos')
const brushControl = $('#simplefog-brush-controls');
const navigation = $('#navigation');
if (brushControl.length && navigation.length) {
const h = navigation.height();
brushControl.css({ top: `${h + 30}px` });
canvas.simplefog.setActiveTool(canvas.simplefog.activeTool)
}
}

Expand Down

0 comments on commit 08cb5ff

Please sign in to comment.