Skip to content

Commit

Permalink
Meshspray: fix mesh spray preview circle not updated when pressing sh…
Browse files Browse the repository at this point in the history
…ift oustide of the scene editor
  • Loading branch information
LeoVgr committed Jan 20, 2025
1 parent 008cdc9 commit 99c2242
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions hrt/prefab/l3d/MeshSpray.hx
Original file line number Diff line number Diff line change
Expand Up @@ -444,21 +444,28 @@ class MeshSpray extends Spray {

var s2d = shared.root2d.getScene();

var isShiftPressed = false;
ectx.scene.editor.view.element.keydown(function(e) {
if (e.shiftKey)
isShiftPressed = true;
});
ectx.scene.editor.view.element.keyup(function(e) {
isShiftPressed = false;
});

interactive.onMove = function(e) {
var worldPos = ectx.screenToGround(s2d.mouseX, s2d.mouseY);

var shiftPressed = hxd.Key.isDown( hxd.Key.SHIFT);

if( worldPos == null ) {
clearBrushes();
return;
}

drawCircle(worldPos.x, worldPos.y, worldPos.z, (shiftPressed) ? currentConfig.deleteRadius : currentConfig.radius, 5, (shiftPressed) ? 9830400 : 38400);
drawCircle(worldPos.x, worldPos.y, worldPos.z, (isShiftPressed) ? currentConfig.deleteRadius : currentConfig.radius, 5, (isShiftPressed) ? 9830400 : 38400);

if (lastSpray < Date.now().getTime() - 100) {
clearPreview();
if( !shiftPressed ) {
if( !isShiftPressed ) {
previewItemsAround(ectx, worldPos);
}

Expand All @@ -467,7 +474,7 @@ class MeshSpray extends Spray {
binaryChanged = true;

if (sprayEnable) {
if( shiftPressed ) {
if( isShiftPressed ) {
removeItemsAround(worldPos);
} else {
if (currentConfig.density == 1) {
Expand Down

0 comments on commit 99c2242

Please sign in to comment.