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

circles being auto resized (shrunken) over time #61

Open
econolution opened this issue Sep 28, 2015 · 0 comments
Open

circles being auto resized (shrunken) over time #61

econolution opened this issue Sep 28, 2015 · 0 comments

Comments

@econolution
Copy link

We have noticed a problem where as the user is entering + saving new circle locations the coordinates are actually being changed until the circle reduces into such a small overlay it isn't clickable any longer nor editable.
Easiest way to reproduce is simply select circle and click on TARGET property.
Problem relates to radius calculation. There is a 1 pixel difference after saving because of rounding operation. If drawn circle has odd width, for example 95px, radius will be calculated as: 95/2 = 47.5 => 47px.
If this was single isolated reduction/resize it would be ok, but when adding 30 circle overlays, by the time you get to the end of adding/saving the first ones are pin points!!
FILE: imgmap/jscripts/imgmap.js

Fix attempted:
if (area.shape == 'circle') {
width = parseInt(area.style.width, 10);

  •   var radius = Math.floor(width/2) - 1;
    
  •   var radius = Math.max(Math.floor(width/2) - 1, 0);
    

else if (this.areas[id].shape == 'circle') {

  •   var radius = Math.floor(width/2) - 1;
    
  •   var radius = Math.floor(width/2);
    

    if ((width + (diff)) - 1 > 0) {
    //real resize right
    this.areas[this.currentid].style.top = (top + (-1* diff/2)) + 'px';

  •       this.setAreaSize(this.currentid, (width  + (diff)) - 1, (height + (diff)));
    
  •       this.setAreaSize(this.currentid, (width  + (diff)) - 1, (height + (diff)) - 1);
    
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

1 participant