-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
touching mouse-pointer returns false when outside stage #2309
base: develop
Are you sure you want to change the base?
Conversation
@@ -280,6 +280,22 @@ test('isTouchingPoint', t => { | |||
t.end(); | |||
}); | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding this test. Could you also please add a test where the sprite is touching the mouse?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure how to add that test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test('isTouchingMouse', t => {
const r = new Runtime();
const s = new Sprite(null, r);
const renderer = new FakeRenderer();
r.attachRenderer(renderer);
const a = new RenderedTarget(s, r);
a.renderer = renderer;
r.ioDevices.mouse.postData({
x: 0,
y: 0
});
t.equals(a.isTouchingObject('__mouse__'), true);
t.end();
});
I think this will work because FakeRenderer.drawableTouching
always returns true
(haven't tried it though)
It seems like my Python knowledge is causing issues with underscored special names (see also #2427) That should fix the test |
Resolves
Resolves scratchfoundation/scratch-gui#5243
Proposed Changes
Adds
getIsOutside
function in io/mouse and uses it inside rendered-targetisTouchingObject
. If the param is__mouse__
and getIsOutside is true, it returns false.Reason for Changes
See scratchfoundation/scratch-gui#5243
Test Coverage
Added one test.