javascript - openlayers3 feature disapear layer style -
i'm working on embedded "gps". our embedded browser qt5.3 webpluging rather old can't upgrade our qt yet.
the problem when update marker of current position disappear 10s or more. here link working example or problem: https://jsfiddle.net/6c8negae/3/. in firefox there no problem image disapear in our browser.
the style compute:
var style_on = new ol.style.style({ image: new ol.style.icon({ // not actual arrow use: ours 30*30, 1.9kio src: "http://images.easyfreeclipart.com/1067/double-up-arrow-1067454.jpg" }) }); var style_off = new ol.style.style({ image: new ol.style.icon({ // grayed image of style_on arrow src: "http://images.easyfreeclipart.com/1067/double-up-arrow-1067454.jpg" }) });
how select style:
map.addlayer(new ol.layer.vector({ type: 'markers', source: markers, style: function (feature) { var style = null; if (feature.get('vtype') === 'cur') { style = feature.get('fade') ? style_off : style_on; style.getimage().setrotation(feature.get('rotation')); } else { style = new ol.style.style({ image: new ol.style.circle({ radius: 6, opacity: 0.5, fill: new ol.style.fill({ color: colors[feature.get('vtype')] }) }) }); } return [style]; } }));
are there workaround? don't more efficient have 1 style per feature (as of our original code way).
try base64 encoded image:
var iconstyle = new ol.style.style({ image: new ol.style.icon({ src: 'data:image/png;base64,ivborw0kggoaaaansuheugaaabgaaaaycayaaadgdz34aaaagxrfwhrtb2z0d2fyzqbbzg9izsbjbwfnzvjlywr5ccllpaaaanrjrefuenrsksergyaqrfdtqs7pi3yqs0kjhljfiggdparboitcc7geldobdcriqnbkdoab0c97sapaus+63xk68wipdb00e6aeh3h68djli6evqanv5erhqstycfdlsaoukmanpctbafiibixgsqkkwqmsfibpjkgah0lmjtgjszdispxvy7fwvpnm8hag+3thhu3a28wbngrieuvz/gyukqzykvyud5kzsqwwyqtbj0qnt0i+8jegkdrr4bnje8jnagk+t/42sb2gktdf8aoctwadadyvwhxy2ypjaaaaaelftksuqmcc' }) });
Comments
Post a Comment