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

Dynamic coordinates are not resized according to Screen size. #84

Open
akshaypjoshi opened this issue Jun 26, 2020 · 3 comments
Open

Dynamic coordinates are not resized according to Screen size. #84

akshaypjoshi opened this issue Jun 26, 2020 · 3 comments

Comments

@akshaypjoshi
Copy link

In React,

If we used the static coordinates in map tag, it works and we get updated coordinates according to screen size. But In case of dynamic coordinates that are set in react state or props, these coordinates never changed.

   <img
       src={imageSrc}
       useMap="#imageMap"
       alt={"Image"}
       width={'auto'}
       height={`${containerHeight}px`}
   />
   
   <map name="imageMap">
      { coordinatesArray.map( coordinate => {
             <area
                   onClick={() => this.onClickEvent}
                   href={"javascript:void(0)"}
                   coords={`${coordinate.topLeftX},${coordinate.topLeftY},${coordinate.bottomRightX},${coordinate.bottomRightY}`}
                   shape="rect"
            />
       }
      }
   </map>

@davidjbradshaw
Copy link
Owner

Not a supported use case, you would need to delete …resize from the HTML node and then recall the setup function every time you change those values

@akshaypjoshi
Copy link
Author

@davidjbradshaw Can you show me some snippet? How that will work?

@akshaypjoshi
Copy link
Author

@davidjbradshaw I have used imageMapResizer() function in componentDidMount but its not working. It overrides when HTML re-renders.

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

No branches or pull requests

2 participants