@@ -38,6 +38,8 @@ proto.update = function update(opts) {
3838 // IMPORTANT: must create source before layer to not cause errors
3939 this . updateSource ( opts ) ;
4040 this . updateLayer ( opts ) ;
41+ } else if ( this . needsNewImage ( opts ) ) {
42+ this . updateImage ( opts ) ;
4143 } else if ( this . needsNewSource ( opts ) ) {
4244 // IMPORTANT: must delete layer before source to not cause errors
4345 this . removeLayer ( ) ;
@@ -52,6 +54,18 @@ proto.update = function update(opts) {
5254 this . visible = isVisible ( opts ) ;
5355} ;
5456
57+ proto . needsNewImage = function ( opts ) {
58+ var map = this . subplot . map ;
59+ return (
60+ map . getSource ( this . idSource ) &&
61+ this . sourceType === 'image' &&
62+ opts . sourcetype === 'image' &&
63+ ( this . source !== opts . source ||
64+ JSON . stringify ( this . coordinates ) !==
65+ JSON . stringify ( opts . coordinates ) )
66+ ) ;
67+ } ;
68+
5569proto . needsNewSource = function ( opts ) {
5670 // for some reason changing layer to 'fill' or 'symbol'
5771 // w/o changing the source throws an exception in mapbox-gl 0.18 ;
@@ -70,6 +84,13 @@ proto.needsNewLayer = function(opts) {
7084 ) ;
7185} ;
7286
87+ proto . updateImage = function ( opts ) {
88+ var map = this . subplot . map ;
89+ map . getSource ( this . idSource ) . updateImage ( {
90+ url : opts . source , coordinates : opts . coordinates
91+ } ) ;
92+ } ;
93+
7394proto . updateSource = function ( opts ) {
7495 var map = this . subplot . map ;
7596
@@ -223,6 +244,11 @@ function convertOpts(opts) {
223244 'text-opacity' : opts . opacity
224245 } ) ;
225246 break ;
247+ case 'raster' :
248+ Lib . extendFlat ( paint , {
249+ 'raster-fade-duration' : 0
250+ } ) ;
251+ break ;
226252 }
227253
228254 return {
0 commit comments