vokseverk / Vokseverk.ImageHotspot

A property editor for Umbraco to place a hotspot on an image (e.g. a place on a map).
https://our.umbraco.com/packages/backoffice-extensions/image-hotspot/
12 stars 5 forks source link

Updating a hotspot results in the hotspot not being populated by PropertyValueConverter #18

Closed digbyswift-joe closed 7 months ago

digbyswift-joe commented 7 months ago

Umbraco 13.2.2, Package version 3.0.4

We have attempted to implement this package in a number of ways (BlockList, Nested Content or as a standalone node). I will use the example where we have this on a standalone node for this ticket.

If we add the property onto the node / element, I can select and persist a hotspot fine. This hotspot then loads onto my site page completely fine.

I am finding that any subsequent updates to the hotspot (such as moving it slightly to the left / right etc) results in the hotspot not being populated when rendering my models.

Looking at the data in the database, I can see that all the values are still present against the datatype in my [umbracoPropertyData] table, which leads me to think that the issue resides within the converter? The values all look as I would expect...

{
    "image": "REDACTED",
    "left": 441,
    "top": 403,
    "percentX": 40.833333333333339,
    "percentY": 56.128133704735379,
    "width": "1080",
    "height": 718
}

Upon update, the values change to float values for top & left

{
    "image": "REDACTED",
    "left": 435.1999816894531,
    "top": 402.375,
    "percentX": 40.29629460087529,
    "percentY": 56.04108635097493,
    "width": "1080",
    "height": 718
}

I believe this would then cause an issue with the property value converter here: https://github.com/vokseverk/Vokseverk.ImageHotspot/blob/master/src/v10/ImageHotspotPropertyConverter.cs which would be expecting integer values and may explain why the model always returns a null result.

greystate commented 7 months ago

Hi @digbyswift-joe

Thank you for raising this issue πŸ™Œ

I've been seeing something similar on some implementations, but never been able to reproduce it consitently β€” this is excellent detective work. Hopefully this will lead to a permanent fix.

digbyswift-joe commented 7 months ago

@greystate Thank you for reviewing so promptly, I'm glad the info provided was of assistance.

I have tested your latest version, and upon modifying and resaving any existing hotspots things are now working as expected πŸ‘

greystate commented 7 months ago

@digbyswift-joe No worries! I had not been able to replicate the weird behaviors until I saw the floats in your exhibit, then it dawned on me β€œWhen would that ever happen??” - and then I zoomed out the Backoffice on my 13" Macbook... whoa!! 😁

Thanks again for using the package πŸ‘