[OpenLayers-Users] Canvas issue when using externalGraphic

Xavier Mamano (jorix) xavier.mamano at gmail.com
Mon Aug 19 06:48:21 PDT 2013


Hi Alexandre,

See at:
https://github.com/jorix/openlayers/commit/aefdde69c620c1dd1497572e17662949e18d5daa

Xavier


Alexandre Dubé wrote
> Xavier,
> 
>    Thank you very much for your efforts.  I'm looking forward to see 
> your patch as I don't understand what the issue with the onLoad is.
> 
> Thanks again,
> 
> Alexandre
> 
> 
> On 13-08-18 07:03 PM, Xavier Mamano (jorix) wrote:
>> Hi Alexandre (second time),
>>
>> I've had it in front and did not see it, the "onLoad" is the PROBLEM!
>>
>> I think I can prepare a Canvas.js patch...
>>
>> Xavier
>>
>>
>> Xavier Mamano (jorix) wrote
>>> Hi Alexandre,
>>>
>>>> but it would still be nice to nail the cause of the issue.
>>> See: http://jsfiddle.net/jorix/X77cw/
>>> (after returning from a week in the mountains offline... I extracted the
>>> code from Canvas.js to set an example of the problem without using
>>> OpenLayers)
>>>
>>> Try "d1" or "d2", so operates properly.
>>> But "d1 & d2" not!, the result should be as "d2" (not as d1+d2) :(
>>>
>>> Regards,
>>>
>>> Xavier
>>> Alexandre Dubé wrote
>>>> Xavier,
>>>>
>>>>     You're right.  Thanks for sharing your solutions.  I think using
>>>> your
>>>> workaround (locking the renderer on unselectAll) combined with a
>>>> tolerance of 0 could do the trick for me, but it would still be nice to
>>>> nail the cause of the issue.
>>>>
>>>>     I'll update my example.
>>>>
>>>> Thanks again,
>>>>
>>>> Alexandre
>>>>
>>>>
>>>> On 13-08-09 04:46 PM, Xavier Mamano (jorix) wrote:
>>>>> Hi
>>>>>
>>>>> But the problem remains when the clickout has a little drag before
>>>>> (less
>>>>> than 4 pixels --see clickTolerance on OpenLayers.Handler.Feature--)
>>>>>
>>>>> Try select the features, and unselect by: mousedown + mousemove (less
>>>>> than 4
>>>>> pixels) + mouseup. Oops!
>>>>>
>>>>> Seems that "this.canvas.clearRect (0, 0, width, height);" on
>>>>> Canvas.redraw
>>>>> does not act a second time while the js code is still running.
>>>>>
>>>>> Xavier
>>>>>
>>>>>
>>>>> Xavier Mamano (jorix) wrote
>>>>>> Hi,
>>>>>>
>>>>>>
>>>>>> I tried your workaround...
>>>>>>
>>>>>> It works on Chrome but not on FF.
>>>>>>
>>>>>> And tried this:
>>>>>>               select.unselectAll = function(options) {
>>>>>>                   vectors.renderer.locked = true;
>>>>>>                  
>>>>>> OpenLayers.Control.SelectFeature.prototype.unselectAll.apply(
>>>>>>                                             this, arguments);
>>>>>>                   vectors.renderer.locked = false;
>>>>>>                   vectors.moveTo(null, true, false); // to force a
>>>>>> vectors.redraw();
>>>>>>               };
>>>>>>
>>>>>> It works on FF & Chrome.
>>>>>>
>>>>>> Xavier
>>>>>> Alexandre Dubé wrote
>>>>>>> Hi,
>>>>>>>
>>>>>>>      Here's a pretty dirty workaround:
>>>>>>> http://dev5.mapgears.com/openlayers/2.12-canvas-issue/examples/canvas-issue-workaround.html?renderer=Canvas
>>>>>>>
>>>>>>>      In summary, I redraw the layer after features were unselected.
>>>>>>>
>>>>>>>      I'm still not sure what's the cause of the issue, but I noticed
>>>>>>> that
>>>>>>> when calling the unselectAll method of the select control, each
>>>>>>> feature
>>>>>>> are drawn (using layer.drawFeature method) separately, resulting in
>>>>>>> redrawing the layer X times for each feature that were unselected.
>>>>>>> Maybe if the renderer was locked while unselecting all these it
>>>>>>> could
>>>>>>> do
>>>>>>> the trick.
>>>>>>>
>>>>>>>      Please, let me know if this should deserve an Issue opened.
>>>>>>>
>>>>>>> Alexandre
>>>>>>>
>>>>>>>
>>>>>>> On 13-08-07 01:14 PM, Alexandre Dubé wrote:
>>>>>>>> Thanks to everyone who tried the example.  I'll try to can come up
>>>>>>>> with a fix or a workaround asap.
>>>>>>>>
>>>>>>>> Alexandre
>>>>>>>>
>>>>>>>>
>>>>>>>> On 13-08-07 11:02 AM, Xavier Mamano (jorix) wrote:
>>>>>>>>> Hi,
>>>>>>>>>
>>>>>>>>> I can confirm seeing this using Windows Vista on Chrome, FF, IE9
>>>>>>>>> and
>>>>>>>>> Opera
>>>>>>>>> and olso usign Ubuntu on Chome and FF.
>>>>>>>>>
>>>>>>>>> (using your canvas-issue.html)
>>>>>>>>>
>>>>>>>>> Xavier Mamano
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Alexandre Dubé wrote
>>>>>>>>>> Hi,
>>>>>>>>>>
>>>>>>>>>>       I have an issue when I use Canvas as vector renderer in
>>>>>>>>>> addition
>>>>>>>>>> to
>>>>>>>>>> having externalGraphic properties.  I noticed the issue using
>>>>>>>>>> OpenLayers
>>>>>>>>>> 2.12, 2.13 and 2.13.1, with the 3 browsers I tested: Chrome,
>>>>>>>>>> Firefox
>>>>>>>>>> and
>>>>>>>>>> IE9.
>>>>>>>>>>
>>>>>>>>>>       I made a small demo to show the issue 'live':
>>>>>>>>>> http://dev5.mapgears.com/openlayers/2.12-canvas-issue/examples/canvas-issue.html?renderer=Canvas
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>       Before trying to look deeper at the code to see what's
>>>>>>>>>> going
>>>>>>>>>> on
>>>>>>>>>> wrong, I wonder if anyone already hit this same issue and came up
>>>>>>>>>> with a
>>>>>>>>>> fix / solution / workaround.
>>>>>>>>>>
>>>>>>>>>> Many thanks,
>>>>>>>>>>
>>>>>>>>>> Alexandre
>>>>>>>>>>
>>>>>>>>>> P.S. The example's html file can be downloaded and added to any
>>>>>>>>>> local
>>>>>>>>>> examples folder in order to test it locally with different
>>>>>>>>>> versions
>>>>>>>>>> of
>>>>>>>>>> OpenLayers, i.e. the images and externalGraphic links are
>>>>>>>>>> absolute,
>>>>>>>>>> not
>>>>>>>>>> relative.
>>>>>>>>>>
>>>>>>>>>> -- 
>>>>>>>>>> Alexandre Dubé
>>>>>>>>>> Mapgears
>>>>>>>>>> www.mapgears.com
>>>>>>>>>>
>>>>>>>>>> _______________________________________________
>>>>>>>>>> Users mailing list
>>>>>>>>>> Users at .osgeo
>>>>>>>>>> http://lists.osgeo.org/mailman/listinfo/openlayers-users
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> -- 
>>>>>>>>> View this message in context:
>>>>>>>>> http://osgeo-org.1560.x6.nabble.com/Canvas-issue-when-using-externalGraphic-tp5071099p5071319.html
>>>>>>>>> Sent from the OpenLayers Users mailing list archive at Nabble.com.
>>>>>>>>> _______________________________________________
>>>>>>>>> Users mailing list
>>>>>>>>>
>>>>>>> Users at .osgeo
>>>>>>>>> http://lists.osgeo.org/mailman/listinfo/openlayers-users
>>>>>>> -- 
>>>>>>> Alexandre Dubé
>>>>>>> Mapgears
>>>>>>> www.mapgears.com
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> Users mailing list
>>>>>>> Users at .osgeo
>>>>>>> http://lists.osgeo.org/mailman/listinfo/openlayers-users
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> View this message in context:
>>>>> http://osgeo-org.1560.x6.nabble.com/Canvas-issue-when-using-externalGraphic-tp5071099p5071801.html
>>>>> Sent from the OpenLayers Users mailing list archive at Nabble.com.
>>>>> _______________________________________________
>>>>> Users mailing list
>>>>>
>>>> Users at .osgeo
>>>>> http://lists.osgeo.org/mailman/listinfo/openlayers-users
>>>>
>>>> -- 
>>>> Alexandre Dubé
>>>> Mapgears
>>>> www.mapgears.com
>>>>
>>>> _______________________________________________
>>>> Users mailing list
>>>> Users at .osgeo
>>>> http://lists.osgeo.org/mailman/listinfo/openlayers-users
>>
>>
>>
>>
>> --
>> View this message in context:
>> http://osgeo-org.1560.x6.nabble.com/Canvas-issue-when-using-externalGraphic-tp5071099p5073053.html
>> Sent from the OpenLayers Users mailing list archive at Nabble.com.
>> _______________________________________________
>> Users mailing list
>> 

> Users at .osgeo

>> http://lists.osgeo.org/mailman/listinfo/openlayers-users
> 
> 
> -- 
> Alexandre Dubé
> Mapgears
> www.mapgears.com
> 
> _______________________________________________
> Users mailing list

> Users at .osgeo

> http://lists.osgeo.org/mailman/listinfo/openlayers-users





--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Canvas-issue-when-using-externalGraphic-tp5071099p5073154.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.


More information about the Users mailing list