@@ -38,6 +38,8 @@ proto.update = function update(opts) {
38
38
// IMPORTANT: must create source before layer to not cause errors
39
39
this . updateSource ( opts ) ;
40
40
this . updateLayer ( opts ) ;
41
+ } else if ( this . needsNewImage ( opts ) ) {
42
+ this . updateImage ( opts ) ;
41
43
} else if ( this . needsNewSource ( opts ) ) {
42
44
// IMPORTANT: must delete layer before source to not cause errors
43
45
this . removeLayer ( ) ;
@@ -52,6 +54,18 @@ proto.update = function update(opts) {
52
54
this . visible = isVisible ( opts ) ;
53
55
} ;
54
56
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
+
55
69
proto . needsNewSource = function ( opts ) {
56
70
// for some reason changing layer to 'fill' or 'symbol'
57
71
// w/o changing the source throws an exception in mapbox-gl 0.18 ;
@@ -70,6 +84,13 @@ proto.needsNewLayer = function(opts) {
70
84
) ;
71
85
} ;
72
86
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
+
73
94
proto . updateSource = function ( opts ) {
74
95
var map = this . subplot . map ;
75
96
@@ -223,6 +244,11 @@ function convertOpts(opts) {
223
244
'text-opacity' : opts . opacity
224
245
} ) ;
225
246
break ;
247
+ case 'raster' :
248
+ Lib . extendFlat ( paint , {
249
+ 'raster-fade-duration' : 0
250
+ } ) ;
251
+ break ;
226
252
}
227
253
228
254
return {
0 commit comments