Skip to content

Commit df7a096

Browse files
author
obiot
committed
Ticket #4 : use addEventListener to register on the resize event and also register on the orientationchange event
1 parent 9afd056 commit df7a096

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/vendors/minpubsub.src.js

+1
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@
104104

105105
/**
106106
* Channel Constant for when the (browser) window is resized <br>
107+
* note the `orientationchange` event will also trigger this channel<br>
107108
* Data passed : {Event} Event object <br>
108109
* @public
109110
* @type {String}

src/video/video.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,9 @@
225225
game_width_zoom = game_width * me.sys.scale.x;
226226
game_height_zoom = game_height * me.sys.scale.y;
227227

228-
//add a channel for the onresize event
229-
window.onresize = function (event) {me.event.publish(me.event.WINDOW_ONRESIZE, [event])};
228+
//add a channel for the onresize/onorientationchange event
229+
window.addEventListener('resize', function (event) {me.event.publish(me.event.WINDOW_ONRESIZE, [event])}, false);
230+
window.addEventListener('orientationchange', function (event) {me.event.publish(me.event.WINDOW_ONRESIZE, [event])}, false);
230231

231232
// register to the channel
232233
me.event.subscribe(me.event.WINDOW_ONRESIZE, me.video.onresize.bind(me.video));

0 commit comments

Comments
 (0)