Skip to content

Commit 74c1022

Browse files
authored
Merge pull request #1 from isystk/feature/rotation
2 parents ac33c39 + fce505a commit 74c1022

File tree

5 files changed

+104
-237
lines changed

5 files changed

+104
-237
lines changed

package-lock.json

Lines changed: 37 additions & 52 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/assets/js/jquery-isystkMovie.js

Lines changed: 4 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -302,70 +302,23 @@
302302
movieBox.find('.playBtn').css('height', '30%');
303303
}
304304

305-
const playBtnTop = Math.floor((h * 0.5) - (playBtnHeight * 0.5));
306-
const playBtnLeft = Math.floor((w * 0.5) - (playBtnWidth * 0.5));
307305
let playTimeFontSize = Math.floor(playBtnWidth * 0.25);
308306
if (20 < playTimeFontSize) {
309307
playTimeFontSize = 20;
310308
}
311309
const playTimeTop = Math.floor(h - (2 * playTimeFontSize));
312310

313311
movieBox.css('width', w + 'px').css('height', h + 'px');
314-
movieBox.find('.playBtn').css('top', playBtnTop + 'px').css('left', playBtnLeft + 'px');
312+
movieBox.find('.playBtn')
313+
.css('top', '50%')
314+
.css('left', '50%')
315+
.css('transform', 'translate(-50%, -50%)');
315316
movieBox.find('.playTime').css('top', playTimeTop + 'px').css('font-size', playTimeFontSize + 'px');
316317

317318
};
318319

319-
// 画面が回転された場合
320-
const restore = function (obj) {
321-
const target = [];
322-
$(obj).each(function () {
323-
const self = $(this);
324-
if (!self.hasClass('movieBox') || self.hasClass('noRestore')) {
325-
return;
326-
}
327-
const image = self.prev();
328-
self.remove();
329-
image.show();
330-
target.push(image);
331-
});
332-
333-
let maxCount = target.length;
334-
const movieBoxs = [];
335-
$(target).each(function () {
336-
new init(this).exec(function (movieBox) {
337-
movieBoxs.push(movieBox);
338-
maxCount--;
339-
if (maxCount === 0 && callbackfunc) {
340-
callbackfunc(movieBoxs);
341-
}
342-
});
343-
});
344-
}
345-
346320
const target = $(this);
347321

348-
// 実機の場合は回転処理、それ以外はリサイズ処理
349-
if (0 > navigator.userAgent.indexOf('iPhone') && 0 > navigator.userAgent.indexOf('iPad') && 0 > navigator.userAgent.indexOf('iPod') && 0 > navigator.userAgent.indexOf('Android')) {
350-
// // 画面がリサイズされた場合
351-
// $(window).resize(function() {
352-
// restore(obj.next());
353-
// if (resizeCallback) {
354-
// resizeCallback(obj);
355-
// }
356-
// });
357-
} else {
358-
// 画面が回転された場合
359-
$(window).on('orientationchange', function () {
360-
setTimeout(function () {
361-
restore(obj.next());
362-
if (resizeCallback) {
363-
resizeCallback(obj);
364-
}
365-
}, 200);
366-
});
367-
}
368-
369322
let maxCount = target.length;
370323
const movieBoxs = [];
371324
target.each(function () {

0 commit comments

Comments
 (0)