Skip to content
This repository has been archived by the owner on Apr 2, 2023. It is now read-only.

OpenLayer Image stretched using annotorious #218

Open
Shubham-Tops opened this issue Apr 9, 2020 · 0 comments
Open

OpenLayer Image stretched using annotorious #218

Shubham-Tops opened this issue Apr 9, 2020 · 0 comments

Comments

@Shubham-Tops
Copy link

Hi,

I am using annotorious plugin in my project. I am using it with openLayer and in that ImageLayer. The issue which I am facing is when I initialize plugin, image get stretched. Check my code below.
init_annotorious = function()
{
var img_src = $('#map').attr('attr-img-src');

  $('#map').removeClass('annotorious_map');

  if(typeof img_src != "undefined" && img_src != "")
  {
    $('#map').addClass('annotorious_map');

    $('.annotate-action-btn').show();

    anno.destroy();

    $('#map').html("");
    
    map = new OpenLayers.Map('map', { numZoomLevels: 4 });

    var proof = new OpenLayers.Layer.Image('proofimg', img_src, new OpenLayers.Bounds(-600, -500, 250, 600), new OpenLayers.Size(375, 750));

    proof.setIsBaseLayer(true);

    proof.display(true);

    map.addLayer(proof);

    map.setCenter(new OpenLayers.LonLat(0,0),0,false,true)

    anno.makeAnnotatable(map);
    
    add_floor_coordinates();
  }
}

Note : I am not allowed to change image dimensions at any cost. Image can be of any height width.

I need a way where this height, width could be set automatically.

Below is the line where I think something could be done.
var proof = new OpenLayers.Layer.Image('proofimg', img_src, new OpenLayers.Bounds(-600, -500, 250, 600), new OpenLayers.Size(375, 750));

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

No branches or pull requests

1 participant