Skip to content

Commit 23cb69f

Browse files
authored
Merge branch 'dev-2.0' into fix/mediaelement-texture-perf
2 parents 945372b + 8773a49 commit 23cb69f

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

src/events/pointer.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ function pointer(p5, fn, lifecycles){
2424
signal: this._removeSignal
2525
});
2626
}
27+
28+
window.addEventListener('blur', () => {
29+
this.mouseIsPressed = false;
30+
}, { signal: this._removeSignal });
2731
};
2832

2933
/**

src/strands/p5.strands.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -643,7 +643,8 @@ if (typeof p5 !== "undefined") {
643643
* filterColor.texCoord.x,
644644
* filterColor.texCoord.y + 0.1 * sin(filterColor.texCoord.x * 10)
645645
* ];
646-
* filterColor.set(getTexture(canvasContent, warped));
646+
* let tex = filterColor.canvasContent;
647+
* filterColor.set(getTexture(tex, warped));
647648
* filterColor.end();
648649
* }
649650
*

test/unit/events/mouse.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,13 @@ suite.todo('Mouse Events', function() {
251251
window.dispatchEvent(new MouseEvent('mousedown'));
252252
assert.strictEqual(myp5.mouseIsPressed, true);
253253
});
254+
255+
test('mouseIsPressed should reset to false on blur', function() {
256+
window.dispatchEvent(new PointerEvent('pointerdown'));
257+
assert.strictEqual(myp5.mouseIsPressed, true);
258+
window.dispatchEvent(new Event('blur'));
259+
assert.strictEqual(myp5.mouseIsPressed, false);
260+
});
254261
});
255262

256263
suite('mouseMoved', function() {

0 commit comments

Comments
 (0)