@vpmedia/phaser 1.0.4 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vpmedia/phaser",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "description": "@vpmedia/phaser is the modern ECMAScript port of the popular Phaser game engine v2.6.2",
5
5
  "author": "Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)",
6
6
  "license": "MIT",
@@ -131,15 +131,13 @@ export default class {
131
131
  this._resolveURL(url, obj);
132
132
  }
133
133
 
134
- addSound(key, url, data, webAudio = true, audioTag = false) {
135
- const decoded = audioTag;
134
+ addSound(key, url, data) {
136
135
  this._cache.sound[key] = {
137
136
  url,
138
137
  data,
139
138
  isDecoding: false,
140
- decoded,
141
- webAudio,
142
- audioTag,
139
+ decoded: false,
140
+ webAudio: true,
143
141
  locked: this.game.sound.touchLocked,
144
142
  };
145
143
  this._resolveURL(url, this._cache.sound[key]);
@@ -11,9 +11,6 @@ export default class {
11
11
  this.desktop = false;
12
12
  this.iOS = false;
13
13
  this.iOSVersion = 0;
14
- this.cocoonJS = false;
15
- this.cocoonJSApp = false;
16
- this.cordova = false;
17
14
  this.node = false;
18
15
  this.android = false;
19
16
  this.chromeOS = false;
@@ -30,17 +27,12 @@ export default class {
30
27
  this.chromeVersion = 0;
31
28
  this.firefox = false;
32
29
  this.firefoxVersion = 0;
33
- this.ie = false;
34
- this.ieVersion = 0;
35
- this.trident = false;
36
- this.tridentVersion = 0;
37
30
  this.edge = false;
38
31
  this.mobileSafari = false;
39
32
  this.safari = false;
40
33
  this.safariVersion = 0;
41
34
  this.webApp = false;
42
35
  this.silk = false;
43
- this.audioData = false;
44
36
  this.webAudio = false;
45
37
  this.ogg = false;
46
38
  this.opus = false;
@@ -109,18 +109,9 @@ export function checkInput(device) {
109
109
  if (window.navigator.msPointerEnabled || window.navigator.pointerEnabled) {
110
110
  device.mspointer = true;
111
111
  }
112
- if (!device.cocoonJS) {
113
- // See https://developer.mozilla.org/en-US/docs/Web/Events/wheel
114
- if ('onwheel' in window || (device.ie && 'WheelEvent' in window)) {
115
- // DOM3 Wheel Event: FF 17+, IE 9+, Chrome 31+, Safari 7+
116
- device.wheelEvent = 'wheel';
117
- } else if ('onmousewheel' in window) {
118
- // Non-FF legacy: IE 6-9, Chrome 1-31, Safari 5-7.
119
- device.wheelEvent = 'mousewheel';
120
- } else if (device.firefox && 'MouseScrollEvent' in window) {
121
- // FF prior to 17. This should probably be scrubbed.
122
- device.wheelEvent = 'DOMMouseScroll';
123
- }
112
+ // See https://developer.mozilla.org/en-US/docs/Web/Events/wheel
113
+ if ('onwheel' in window || 'WheelEvent' in window) {
114
+ device.wheelEvent = 'wheel';
124
115
  }
125
116
  }
126
117
 
@@ -186,19 +177,11 @@ export function checkBrowser(device) {
186
177
  device.firefoxVersion = parseInt(RegExp.$1, 10);
187
178
  } else if (/AppleWebKit/.test(ua) && device.iOS) {
188
179
  device.mobileSafari = true;
189
- } else if (/MSIE (\d+\.\d+);/.test(ua)) {
190
- device.ie = true;
191
- device.ieVersion = parseInt(RegExp.$1, 10);
192
180
  } else if (/Safari\/(\d+)/.test(ua) && !device.windowsPhone) {
193
181
  device.safari = true;
194
182
  if (/Version\/(\d+)\./.test(ua)) {
195
183
  device.safariVersion = parseInt(RegExp.$1, 10);
196
184
  }
197
- } else if (/Trident\/(\d+\.\d+)(.*)rv:(\d+\.\d+)/.test(ua)) {
198
- device.ie = true;
199
- device.trident = true;
200
- device.tridentVersion = parseInt(RegExp.$1, 10);
201
- device.ieVersion = parseInt(RegExp.$3, 10);
202
185
  }
203
186
  // Silk gets its own if clause because its ua also contains 'Safari'
204
187
  if (/Silk/.test(ua)) {
@@ -208,22 +191,9 @@ export function checkBrowser(device) {
208
191
  if (navigator.standalone) {
209
192
  device.webApp = true;
210
193
  }
211
- if (typeof window.cordova !== 'undefined') {
212
- device.cordova = true;
213
- }
214
194
  if (typeof process !== 'undefined' && typeof require !== 'undefined') {
215
195
  device.node = true;
216
196
  }
217
- if (navigator.isCocoonJS) {
218
- device.cocoonJS = true;
219
- }
220
- if (device.cocoonJS) {
221
- try {
222
- device.cocoonJSApp = (typeof CocoonJS !== 'undefined');
223
- } catch (e) {
224
- device.cocoonJSApp = false;
225
- }
226
- }
227
197
  }
228
198
 
229
199
  /**
@@ -262,7 +232,6 @@ export function checkVideo(device) {
262
232
  * @param {object} device TBD
263
233
  */
264
234
  export function checkAudio(device) {
265
- device.audioData = !!(window.Audio);
266
235
  device.webAudio = !!(window.AudioContext || window.webkitAudioContext);
267
236
  const audioElement = document.createElement('audio');
268
237
  try {
@@ -371,15 +340,9 @@ export function whenReady(device, callback, context, nonPrimer) {
371
340
  readyCheck._monitor = readyCheck.bind(device);
372
341
  readyCheck._queue = readyCheck._queue || [];
373
342
  readyCheck._queue.push([callback, context]);
374
- const cordova = typeof window.cordova !== 'undefined';
375
- const cocoonJS = navigator.isCocoonJS;
376
343
  if (document.readyState === 'complete' || document.readyState === 'interactive') {
377
344
  // Why is there an additional timeout here?
378
345
  window.setTimeout(readyCheck._monitor, 0);
379
- } else if (cordova && !cocoonJS) {
380
- // Ref. http://docs.phonegap.com/en/3.5.0/cordova_events_events.md.html#deviceready
381
- // Cordova, but NOT Cocoon?
382
- document.addEventListener('deviceready', readyCheck._monitor, false);
383
346
  } else {
384
347
  document.addEventListener('DOMContentLoaded', readyCheck._monitor, false);
385
348
  window.addEventListener('load', readyCheck._monitor, false);
@@ -168,9 +168,6 @@ export default class {
168
168
  this.renderer = new CanvasRenderer(this);
169
169
  this.context = this.renderer.context;
170
170
  }
171
- if (this.device && this.device.cocoonJS && this.renderer) {
172
- this.canvas.screencanvas = this.renderer.type === RENDER_CANVAS;
173
- }
174
171
  if (this.config.renderType !== RENDER_HEADLESS) {
175
172
  this.stage.smoothed = this.config.antialias;
176
173
  addToDOM(this.canvas, this.parent, false);
@@ -106,20 +106,13 @@ export default class {
106
106
  canvas.addEventListener('mousedown', this._onMouseDown, true);
107
107
  canvas.addEventListener('mousemove', this._onMouseMove, true);
108
108
  canvas.addEventListener('mouseup', this._onMouseUp, true);
109
- if (!this.game.device.cocoonJS) {
110
- window.addEventListener('mouseup', this._onMouseUpGlobal, true);
111
- window.addEventListener('mouseout', this._onMouseOutGlobal, true);
112
- canvas.addEventListener('mouseover', this._onMouseOver, true);
113
- canvas.addEventListener('mouseout', this._onMouseOut, true);
114
- }
109
+ window.addEventListener('mouseup', this._onMouseUpGlobal, true);
110
+ window.addEventListener('mouseout', this._onMouseOutGlobal, true);
111
+ canvas.addEventListener('mouseover', this._onMouseOver, true);
112
+ canvas.addEventListener('mouseout', this._onMouseOut, true);
115
113
  const wheelEvent = this.game.device.wheelEvent;
116
114
  if (wheelEvent) {
117
115
  canvas.addEventListener(wheelEvent, this._onMouseWheel, true);
118
- if (wheelEvent === 'mousewheel') {
119
- this._wheelEvent = new WheelEventProxy(-1 / 40, 1);
120
- } else if (wheelEvent === 'DOMMouseScroll') {
121
- this._wheelEvent = new WheelEventProxy(1, 1);
122
- }
123
116
  }
124
117
  }
125
118
 
@@ -46,15 +46,13 @@ export default class {
46
46
  canvas.addEventListener('pointerup', this._onMSPointerUp, false);
47
47
  canvas.style['-ms-content-zooming'] = 'none';
48
48
  canvas.style['-ms-touch-action'] = 'none';
49
- if (!this.game.device.cocoonJS) {
50
- window.addEventListener('MSPointerUp', this._onMSPointerUpGlobal, true);
51
- canvas.addEventListener('MSPointerOver', this._onMSPointerOver, true);
52
- canvas.addEventListener('MSPointerOut', this._onMSPointerOut, true);
53
- // IE11+ uses non-prefix events
54
- window.addEventListener('pointerup', this._onMSPointerUpGlobal, true);
55
- canvas.addEventListener('pointerover', this._onMSPointerOver, true);
56
- canvas.addEventListener('pointerout', this._onMSPointerOut, true);
57
- }
49
+ window.addEventListener('MSPointerUp', this._onMSPointerUpGlobal, true);
50
+ canvas.addEventListener('MSPointerOver', this._onMSPointerOver, true);
51
+ canvas.addEventListener('MSPointerOut', this._onMSPointerOut, true);
52
+ // IE11+ uses non-prefix events
53
+ window.addEventListener('pointerup', this._onMSPointerUpGlobal, true);
54
+ canvas.addEventListener('pointerover', this._onMSPointerOver, true);
55
+ canvas.addEventListener('pointerout', this._onMSPointerOut, true);
58
56
  }
59
57
 
60
58
  stop() {
@@ -42,10 +42,8 @@ export default class {
42
42
  this.game.canvas.addEventListener('touchmove', this._onTouchMove, false);
43
43
  this.game.canvas.addEventListener('touchend', this._onTouchEnd, false);
44
44
  this.game.canvas.addEventListener('touchcancel', this._onTouchCancel, false);
45
- if (!this.game.device.cocoonJS) {
46
- this.game.canvas.addEventListener('touchenter', this._onTouchEnter, false);
47
- this.game.canvas.addEventListener('touchleave', this._onTouchLeave, false);
48
- }
45
+ this.game.canvas.addEventListener('touchenter', this._onTouchEnter, false);
46
+ this.game.canvas.addEventListener('touchleave', this._onTouchLeave, false);
49
47
  }
50
48
 
51
49
  stop() {
@@ -627,12 +627,7 @@ export default class {
627
627
  case 'audio':
628
628
  file.url = this.getAudioURL(file.url);
629
629
  if (file.url) {
630
- // WebAudio or Audio Tag?
631
- if (this.game.sound.usingWebAudio) {
632
- this.xhrLoad(file, this.transformUrl(file.url, file), 'arraybuffer', this.fileComplete);
633
- } else if (this.game.sound.usingAudioTag) {
634
- this.loadAudioTag(file);
635
- }
630
+ this.xhrLoad(file, this.transformUrl(file.url, file), 'arraybuffer', this.fileComplete);
636
631
  } else {
637
632
  this.fileError(file, null, 'No supported audio URL specified or device does not have audio playback support');
638
633
  }
@@ -716,35 +711,6 @@ export default class {
716
711
  console.warn('loader.loadVideoTag() is not implemented');
717
712
  }
718
713
 
719
- loadAudioTag(file) {
720
- const scope = this;
721
- if (this.game.sound.touchLocked) {
722
- // If audio is locked we can't do this yet, so need to queue this load request. Bum.
723
- file.data = new Audio();
724
- file.data.name = file.key;
725
- file.data.preload = 'auto';
726
- file.data.src = this.transformUrl(file.url, file);
727
- this.fileComplete(file);
728
- } else {
729
- file.data = new Audio();
730
- file.data.name = file.key;
731
- const playThroughEvent = () => {
732
- file.data.removeEventListener('canplaythrough', playThroughEvent, false);
733
- file.data.onerror = null;
734
- scope.fileComplete(file);
735
- };
736
- file.data.onerror = () => {
737
- file.data.removeEventListener('canplaythrough', playThroughEvent, false);
738
- file.data.onerror = null;
739
- scope.fileError(file);
740
- };
741
- file.data.preload = 'auto';
742
- file.data.src = this.transformUrl(file.url, file);
743
- file.data.addEventListener('canplaythrough', playThroughEvent, false);
744
- file.data.load();
745
- }
746
- }
747
-
748
714
  xhrLoad(file, url, type, onload, onerror) {
749
715
  const xhr = new XMLHttpRequest();
750
716
  xhr.open('GET', url, true);
@@ -904,14 +870,10 @@ export default class {
904
870
  this.cache.addVideo(file.key, file.url, file.data, file.asBlob);
905
871
  break;
906
872
  case 'audio':
907
- if (this.game.sound.usingWebAudio) {
908
- file.data = xhr.response;
909
- this.cache.addSound(file.key, file.url, file.data, true, false);
910
- if (file.autoDecode) {
911
- this.game.sound.decode(file.key);
912
- }
913
- } else {
914
- this.cache.addSound(file.key, file.url, file.data, false, true);
873
+ file.data = xhr.response;
874
+ this.cache.addSound(file.key, file.url, file.data);
875
+ if (file.autoDecode) {
876
+ this.game.sound.decode(file.key);
915
877
  }
916
878
  break;
917
879
  case 'text':
@@ -94,7 +94,7 @@ export default class {
94
94
  boot() {
95
95
  // Configure device-dependent compatibility
96
96
  const compat = this.compatibility;
97
- compat.supportsFullScreen = this.game.device.fullscreen && !this.game.device.cocoonJS;
97
+ compat.supportsFullScreen = this.game.device.fullscreen;
98
98
  // We can't do anything about the status bars in iPads, web apps or desktops
99
99
  /*
100
100
  if (!this.game.device.iPad && !this.game.device.webApp && !this.game.device.desktop) {
@@ -35,7 +35,6 @@ export default class {
35
35
  this.override = false;
36
36
  this.allowMultiple = false;
37
37
  this.usingWebAudio = this.game.sound.usingWebAudio;
38
- this.usingAudioTag = this.game.sound.usingAudioTag;
39
38
  this.externalNode = null;
40
39
  this.masterGainNode = null;
41
40
  this.gainNode = null;
@@ -54,16 +53,6 @@ export default class {
54
53
  if (connect) {
55
54
  this.gainNode.connect(this.masterGainNode);
56
55
  }
57
- } else if (this.usingAudioTag) {
58
- if (this.game.cache.getSound(key) && this.game.cache.isSoundReady(key)) {
59
- this._sound = this.game.cache.getSoundData(key);
60
- this.totalDuration = 0;
61
- if (this._sound.duration) {
62
- this.totalDuration = this._sound.duration;
63
- }
64
- } else {
65
- this.game.cache.onSoundUnlock.add(this.soundHasUnlocked, this);
66
- }
67
56
  }
68
57
  this.onDecoded = new Signal();
69
58
  this.onPlay = new Signal();
@@ -219,9 +208,6 @@ export default class {
219
208
  } else if (this.gainNode) {
220
209
  this._sound.disconnect(this.gainNode);
221
210
  }
222
- } else if (this.usingAudioTag) {
223
- this._sound.pause();
224
- this._sound.currentTime = 0;
225
211
  }
226
212
  this.isPlaying = false;
227
213
  }
@@ -311,7 +297,7 @@ export default class {
311
297
  } else if (this.game.cache.getSound(this.key) && this.game.cache.getSound(this.key).locked) {
312
298
  this.game.cache.reloadSound(this.key);
313
299
  this.pendingPlayback = true;
314
- } else if (this._sound && (this.game.device.cocoonJS || this._sound.readyState === 4)) {
300
+ } else if (this._sound && this._sound.readyState === 4) {
315
301
  this._sound.play();
316
302
  // This doesn't become available until you call play(), wonderful ...
317
303
  this.totalDuration = this._sound.duration;
@@ -411,9 +397,6 @@ export default class {
411
397
  } else if (this.gainNode) {
412
398
  this._sound.disconnect(this.gainNode);
413
399
  }
414
- } else if (this.usingAudioTag) {
415
- this._sound.pause();
416
- this._sound.currentTime = 0;
417
400
  }
418
401
  }
419
402
  this.pendingPlayback = false;
@@ -458,14 +441,6 @@ export default class {
458
441
  }
459
442
  }
460
443
 
461
- updateGlobalVolume(globalVolume) {
462
- // this._volume is the % of the global volume this sound should be played at
463
- if (this.usingAudioTag && this._sound) {
464
- this._sound.volume = globalVolume * this._volume;
465
- }
466
-
467
- }
468
-
469
444
  destroy(remove = true) {
470
445
  this._markedToDelete = true;
471
446
  this._removeFromSoundManager = remove;
@@ -502,15 +477,11 @@ export default class {
502
477
  this._muteVolume = this._tempVolume;
503
478
  if (this.usingWebAudio) {
504
479
  this.gainNode.gain.value = 0;
505
- } else if (this.usingAudioTag && this._sound) {
506
- this._sound.volume = 0;
507
480
  }
508
481
  } else {
509
482
  this._muted = false;
510
483
  if (this.usingWebAudio) {
511
484
  this.gainNode.gain.value = this._muteVolume;
512
- } else if (this.usingAudioTag && this._sound) {
513
- this._sound.volume = this._muteVolume;
514
485
  }
515
486
  }
516
487
  this.onMute.dispatch(this);
@@ -521,17 +492,14 @@ export default class {
521
492
  }
522
493
 
523
494
  set volume(value) {
524
- const normalizedValue = this.usingAudioTag ? Math.max(0, Math.min(1, value)) : value;
525
495
  if (this._muted) {
526
- this._muteVolume = normalizedValue;
496
+ this._muteVolume = value;
527
497
  return;
528
498
  }
529
- this._tempVolume = normalizedValue;
530
- this._volume = normalizedValue;
499
+ this._tempVolume = value;
500
+ this._volume = value;
531
501
  if (this.usingWebAudio) {
532
- this.gainNode.gain.value = normalizedValue;
533
- } else if (this.usingAudioTag && this._sound) {
534
- this._sound.volume = normalizedValue;
502
+ this.gainNode.gain.value = value;
535
503
  }
536
504
  }
537
505
 
@@ -18,7 +18,6 @@ export default class {
18
18
  this.context = null;
19
19
  this.baseLatency = 0; // https://developer.mozilla.org/en-US/docs/Web/API/AudioContext/baseLatency
20
20
  this.usingWebAudio = false;
21
- this.usingAudioTag = false;
22
21
  this.noAudio = false;
23
22
  this.connectToMaster = true;
24
23
  this.touchLocked = false;
@@ -55,12 +54,7 @@ export default class {
55
54
  }
56
55
  }
57
56
  if (this.context === null || (this.context && this.context.createGain === undefined && this.context.createGainNode === undefined)) {
58
- // No Web Audio support - how about legacy Audio?
59
- if (window.Audio === undefined) {
60
- this.noAudio = true;
61
- return;
62
- }
63
- this.usingAudioTag = true;
57
+ this.noAudio = true;
64
58
  } else {
65
59
  this.usingWebAudio = true;
66
60
  this.baseLatency = this.context.baseLatency || (256 / (this.context.sampleRate || 44100));
@@ -71,16 +65,21 @@ export default class {
71
65
  }
72
66
  this.masterGain.gain.value = 1;
73
67
  this.masterGain.connect(this.context.destination);
74
- if (this.context.state === 'suspended') {
75
- this.game.input.onUp.addOnce(this.resumeWebAudio, this);
76
- }
77
68
  }
78
- if (!this.noAudio && !this.game.device.cocoonJS && (this.game.device.iOS || this.game.device.android)) {
69
+ if (this.usingWebAudio && (this.game.device.iOS || this.game.device.android)) {
79
70
  this.game.input.addTouchLockCallback(this.unlock, this, true);
80
71
  this.touchLocked = true;
81
72
  }
82
73
  }
83
74
 
75
+ checkContextState() {
76
+ if (this.usingWebAudio && this.context.state === 'suspended') {
77
+ this.game.input.onUp.addOnce(this.resumeWebAudio, this);
78
+ return true;
79
+ }
80
+ return false;
81
+ }
82
+
84
83
  resumeWebAudio() {
85
84
  if (this.usingWebAudio && this.context.state === 'suspended') {
86
85
  this.context.resume();
@@ -88,28 +87,21 @@ export default class {
88
87
  }
89
88
 
90
89
  unlock() {
91
- if (this.noAudio || !this.touchLocked || this._unlockSource !== null) {
90
+ if (!this.touchLocked || this._unlockSource !== null) {
92
91
  return true;
93
92
  }
94
- // Global override (mostly for Audio Tag testing)
95
- if (this.usingAudioTag) {
96
- this.touchLocked = false;
97
- this._unlockSource = null;
98
- } else if (this.usingWebAudio) {
99
- // Create empty buffer and play it
100
- // The SoundManager.update loop captures the state of it and then resets touchLocked to false
101
- const buffer = this.context.createBuffer(1, 1, 22050);
102
- this._unlockSource = this.context.createBufferSource();
103
- this._unlockSource.buffer = buffer;
104
- this._unlockSource.connect(this.context.destination);
105
- if (this._unlockSource.start === undefined) {
106
- this._unlockSource.noteOn(0);
107
- } else {
108
- this._unlockSource.start(0);
109
- }
110
- this.resumeWebAudio();
93
+ // Create empty buffer and play it
94
+ // The SoundManager.update loop captures the state of it and then resets touchLocked to false
95
+ const buffer = this.context.createBuffer(1, 1, 22050);
96
+ this._unlockSource = this.context.createBufferSource();
97
+ this._unlockSource.buffer = buffer;
98
+ this._unlockSource.connect(this.context.destination);
99
+ if (this._unlockSource.start === undefined) {
100
+ this._unlockSource.noteOn(0);
101
+ } else {
102
+ this._unlockSource.start(0);
111
103
  }
112
- // We can remove the event because we've done what we needed (started the unlock sound playing)
104
+ this.resumeWebAudio();
113
105
  return true;
114
106
  }
115
107
 
@@ -271,12 +263,6 @@ export default class {
271
263
  this._muteVolume = this.masterGain.gain.value;
272
264
  this.masterGain.gain.value = 0;
273
265
  }
274
- // Loop through sounds
275
- for (let i = 0; i < this._sounds.length; i += 1) {
276
- if (this._sounds[i].usingAudioTag) {
277
- this._sounds[i].mute = true;
278
- }
279
- }
280
266
  this.onMute.dispatch();
281
267
  }
282
268
 
@@ -288,12 +274,6 @@ export default class {
288
274
  if (this.usingWebAudio) {
289
275
  this.masterGain.gain.value = this._muteVolume;
290
276
  }
291
- // Loop through sounds
292
- for (let i = 0; i < this._sounds.length; i += 1) {
293
- if (this._sounds[i].usingAudioTag) {
294
- this._sounds[i].mute = false;
295
- }
296
- }
297
277
  this.onUnMute.dispatch();
298
278
  }
299
279
 
@@ -349,13 +329,6 @@ export default class {
349
329
  this._volume = value;
350
330
  if (this.usingWebAudio) {
351
331
  this.masterGain.gain.value = value;
352
- } else {
353
- // Loop through the sound cache and change the volume of all html audio tags
354
- for (let i = 0; i < this._sounds.length; i += 1) {
355
- if (this._sounds[i].usingAudioTag) {
356
- this._sounds[i].updateGlobalVolume(value);
357
- }
358
- }
359
332
  }
360
333
  this.onVolumeChange.dispatch(value);
361
334
  }
@@ -49,10 +49,6 @@ export default class {
49
49
  this.renderSession.shakeX = 0;
50
50
  this.renderSession.shakeY = 0;
51
51
  this.context.globalCompositeOperation = 'source-over';
52
- if (navigator.isCocoonJS && this.view.screencanvas) {
53
- this.context.fillStyle = 'black';
54
- this.context.clear();
55
- }
56
52
  if (this.clearBeforeRender) {
57
53
  if (this.transparent) {
58
54
  this.context.clearRect(0, 0, this.width, this.height);
@@ -196,9 +196,6 @@ export default class extends Image {
196
196
  }
197
197
  this.canvas.height = height * this._res;
198
198
  this.context.scale(this._res, this._res);
199
- if (navigator.isCocoonJS) {
200
- this.context.clearRect(0, 0, this.canvas.width, this.canvas.height);
201
- }
202
199
  if (this.style.backgroundColor) {
203
200
  this.context.fillStyle = this.style.backgroundColor;
204
201
  this.context.fillRect(0, 0, this.canvas.width, this.canvas.height);