Skip to content

Commit 8e92c13

Browse files
committed
Canvas.setSmoothingEnabled only applies the value of the property exists, which avoids the Chrome webkit prefix deprecation warnings.
1 parent f65bca1 commit 8e92c13

3 files changed

Lines changed: 14 additions & 5 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,7 @@ Version 2.4 - "Katar" - in dev
382382
* RandomDataGenerator.weightedPick has been tweaked slightly to allow for a more even distribution of weights. It still favors the earlier array elements, but will accurately include 'distance' elements as well (thanks @gingerbeardman #1751)
383383
* BitmapData.clear has 4 new optional parameters: x, y, width and height, that define the area to be cleared. If left undefined it works exactly the same as before and clears the entire canvas.
384384
* Added Phaser.Keyboard.COMMA and Phaser.Keyboard.PERIOD to the consts list.
385+
* Canvas.setSmoothingEnabled only applies the value of the property exists, which avoids the Chrome webkit prefix deprecation warnings.
385386

386387
### Bug Fixes
387388

src/core/Create.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
* TODO: Gradient generator
1010
* TODO: Look at sfxr for audio gen
1111
* TODO: Dither support
12+
* TODO: Sprite Sheet generator
1213
*
1314
* @class Phaser.Create
1415
* @constructor

src/system/Canvas.js

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -201,11 +201,18 @@ Phaser.Canvas = {
201201
*/
202202
setSmoothingEnabled: function (context, value) {
203203

204-
context['imageSmoothingEnabled'] = value;
205-
context['mozImageSmoothingEnabled'] = value;
206-
context['oImageSmoothingEnabled'] = value;
207-
context['webkitImageSmoothingEnabled'] = value;
208-
context['msImageSmoothingEnabled'] = value;
204+
var vendor = [ 'i', 'mozI', 'oI', 'webkitI', 'msI' ];
205+
206+
for (var prefix in vendor)
207+
{
208+
var s = vendor[prefix] + 'mageSmoothingEnabled';
209+
210+
if (s in context)
211+
{
212+
context[s] = value;
213+
return context;
214+
}
215+
}
209216

210217
return context;
211218

0 commit comments

Comments
 (0)