Skip to content
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

Canvas GetPixelColor Removes Container Positioning #2673

Open
5 tasks
TIMAI2 opened this issue Apr 16, 2022 · 25 comments · May be fixed by #2848
Open
5 tasks

Canvas GetPixelColor Removes Container Positioning #2673

TIMAI2 opened this issue Apr 16, 2022 · 25 comments · May be fixed by #2848
Assignees

Comments

@TIMAI2
Copy link

TIMAI2 commented Apr 16, 2022

Describe the bug

Screen set to Landscape in Designer (same issue when Portrait)
A vertical arrangement Centre/Centre
A canvas with dimensions larger than the vertical arrangement, inside the vertical arrangement
An imagesprite, centred to the canvas

image

If the GetPixelColor block is run on any x,y coordinates, the color is returned, but the vertical arrangement loses its centre/centre setting and the canvas is set to 0,0 in the vertical arrangement. I have found that if the imageSprite is set to larger than the vertical arrangement, the same issue occurs but drag functionality on the imageSprite is also lost.

image

Affects

  • Designer
  • Blocks editor
  • [x ] Companion
  • [x ] Compiled apps
  • Buildserver
  • Debugging
  • Other... (please describe)

Expected behavior

Run the GetPixelColor block, which returns the colour, and all elements and positioning remains unchanged.

Steps to reproduce

Screen set to Landscape in Designer (same issue when Portrait)
A vertical arrangement Centre/Centre
A canvas with dimensions larger than the vertical arrangement, inside the vertical arrangement
An imagesprite, centred to the canvas
Request getPixelColor of the middle pixel of the canvas (or any other position)
Canvas moves to 0,0 of vertical arrangement, is no longer centred, and dragging of imageSprite can also be affected.

(This doesn't seem to be related to the "really large canvas bug, #2404", canvas only set to 600x800 in a 300x400 VA.)

Example aia
dragImagebug.aia.zip

@daki7711
Copy link
Contributor

The example aia file doesn't seem to be a real aia file. Could you re upload in aia file format? Thanks

@preetvadaliya
Copy link
Collaborator

@daki7711 I think GitHub doesn't support .aia file format so maybe you need to rename the file after download.

@daki7711
Copy link
Contributor

@preetvadaliya Thanks

@daki7711
Copy link
Contributor

@TimCarterLinux would it be possible for us to know which android version you used for this? Thanks

@TIMAI2
Copy link
Author

TIMAI2 commented Jun 23, 2022

If I remember correctly on Android 10 (Genymotion Emulator) and Android 12 Google Pixel 4a (it may have been Android 11 at the time)

@daki7711
Copy link
Contributor

@TimCarterLinux thanks, does this problem still happen? Cause I wasn't able to replicate this problem with my device. Trying to figure out where the problem is stemming from

@TIMAI2
Copy link
Author

TIMAI2 commented Jun 23, 2022

Just retested on devices as above, and the problem still exists on both
A short webm video attached to demonstrate (remove the .zip)
spritepixel.webm.zip

@daki7711
Copy link
Contributor

This is very strange, would it be possible that you re-upload the hland.jpg in your aia file? Cause I did ran into some trouble when using your hland.jpg and it started to work fine after downloading it and re-uploading it

@TIMAI2
Copy link
Author

TIMAI2 commented Jun 25, 2022

I tried re-uploaded the hland.jpg image, I even tried with a completely different image (and removing hland.jpg from the project), the same thing happens

@daki7711
Copy link
Contributor

@TimCarterLinux I think the first thing for me is to find a device that has the same problem. Until now all the devices (three chromebooks, two android tablet, one ipad) I tested works fine with this aia. Have you ever experience something similar with a different aia?

@TIMAI2
Copy link
Author

TIMAI2 commented Jun 29, 2022

I just tried it on my chromebook, and like you say no problem. Could possibly be an issue with My computer (Linux Xubuntu 20.04) and Chromium browser ? Just tested with Firefox and the problem persists.

@daki7711
Copy link
Contributor

I see, interesting. Definitely worth checking out browsers. Thanks for cooperating. @ewpatton what is your take on this?

@preetvadaliya
Copy link
Collaborator

@daki7711 Have you figure out anything related this? I think what is happening there when we call GetPixelColor(x, y) it will build a cache of canvas's bitmap and then returns us a color, but after getting the color we are actually re drawing the canvas using that cache and this is creating a problem. But i am not sure maybe @ewpatton can help you more.

@preetvadaliya
Copy link
Collaborator

@daki7711 please look at this method I am sure you will definitely find something realted this here. Especially on this line...

@daki7711
Copy link
Contributor

@preetvadaliya thanks for that, at the moment I'm struggling to replicate the problem with my devices though

@daki7711
Copy link
Contributor

daki7711 commented Aug 5, 2022

@ewpatton Do you think it is worth investigating different browsers?

@arinmodi
Copy link
Contributor

@preetvadaliya @ewpatton is this still open, I will like to work on this

@arinmodi
Copy link
Contributor

@preetvadaliya @ewpatton, how can i view the Logs mad by Log.e() while using "Do it" Feature in blockly editor. I connected my phone using usb cable. App is running but not able to find the logs.

@ewpatton
Copy link
Member

To see logs, you need to use adb logcat. adb is provided as part of the Android SDK.

@arinmodi
Copy link
Contributor

Already tried it but when adb logcat running it is killing the companion mode and when companion mode is running it is killing adb logcat process.

@ewpatton
Copy link
Member

Are you running in the emulator?

@arinmodi
Copy link
Contributor

No I am using real device, But i have separately downloaded the adb than running it from terminal

@ewpatton
Copy link
Member

I'm not sure I understand what you're saying. adb is a command line tool. The best thing to do is set it up so that adb is on your PATH and then use it in the terminal. Generally, you don't need adb to run the companion (you do need it to install changes). If you're using USB or the emulator, rather than Wifi, to connect, then you will need to make sure that you copy whichever version of adb and replace the version installed by App Inventor's setup tools package.

@arinmodi arinmodi linked a pull request Mar 11, 2023 that will close this issue
@Vickyaryan33
Copy link

Vickyaryan33 commented Mar 14, 2023

I want to contribute in issue please assign me

@ewpatton ewpatton linked a pull request Mar 14, 2023 that will close this issue
@ewpatton
Copy link
Member

@Vickyaryan33 @arinmodi has already submitted a pull request that may address this issue. Please look for other issues marked help wanted for potential first contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants