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

Update the calibration matrix based on SVG viewbox #715

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from

Conversation

philek
Copy link

@philek philek commented Feb 25, 2024

This is my attempt to make the card correctly calibrate the map to vacuum coordinates for Ecovacs.

After the changes in DeebotUniverse/client.py#433 that align the center of the vacuum map and svg generated it is a simple matter of setting the correct scale (1/50), flipping y and then offsetting the map coordinates by the viewbox.
As far as I could figure out, there is no way to get any of the SVG metadata from an img tag, that's why I added an object next to it. If you like I could add it only for ecovacs vacuums.

I had some issues introducing this change without creating an (almost) endless rendering loop, but I think I've finally gotten it sorted out.

@philek philek marked this pull request as ready for review February 25, 2024 15:48

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since HA 2024.2 the custom component is merged into the cores Ecovacs integration and I will archive the custom component soon. I think this file needs to be renamed

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there any functional changes related to this card because of it?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No the migration itself has no functional changes.
With the release of 3.1.0 the integration switched from png to SVG and that change can caused some functional changes. As I don't use your card, I completely forgotten to test it.

The core integration uses also the SVG image

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, do I need to make some changes? In either PR? Or just be patient?

@philek
Copy link
Author

philek commented Feb 27, 2024

Not really sure why that check is failing.

@PiotrMachowski
Copy link
Owner

Not really sure why that check is failing.

Don't worry about it :)

@philek
Copy link
Author

philek commented Mar 2, 2024

Did some more tests and found that it didn't work as expected in Chrome. Couldn't find a good way to check if image is SVG without loading it in an object tag. Checking naturalWidth == 0 only works on Firefox. Decided instead to add a flag for the deebot platform that enables this additional SVG logic. Other platforms should be more or less unchanged.

@philek philek force-pushed the feature/deebot-svg-viewbox branch from 134a577 to 109ce76 Compare March 8, 2024 21:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants