2.8 解决监控屏幕适配问题
This commit is contained in:
@ -141,6 +141,7 @@ const ScreenVideoPlay: React.FC<ScreenVideoPlayProps> = (props) => {
|
|||||||
function setWndCover() {
|
function setWndCover() {
|
||||||
var iWidth = window.innerWidth;
|
var iWidth = window.innerWidth;
|
||||||
var iHeight = window.innerHeight;
|
var iHeight = window.innerHeight;
|
||||||
|
let scale = window.innerHeight / 1080;
|
||||||
var oDivRect = playWnd.current.getBoundingClientRect();
|
var oDivRect = playWnd.current.getBoundingClientRect();
|
||||||
|
|
||||||
var iCoverLeft = (oDivRect.left < 0) ? Math.abs(oDivRect.left) : 0;
|
var iCoverLeft = (oDivRect.left < 0) ? Math.abs(oDivRect.left) : 0;
|
||||||
@ -222,15 +223,16 @@ const ScreenVideoPlay: React.FC<ScreenVideoPlayProps> = (props) => {
|
|||||||
// 监听滚动条scroll事件,使插件窗口跟随浏览器滚动而移动
|
// 监听滚动条scroll事件,使插件窗口跟随浏览器滚动而移动
|
||||||
const resize = () => {
|
const resize = () => {
|
||||||
if (oWebControl != null) {
|
if (oWebControl != null) {
|
||||||
|
let scale = window.innerHeight / 1080;
|
||||||
oWebControl.JS_Resize(playWnd.current.clientWidth * scale, playWnd.current.clientHeight * scale);
|
oWebControl.JS_Resize(playWnd.current.clientWidth * scale, playWnd.current.clientHeight * scale);
|
||||||
setWndCover();
|
setWndCover();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
window.addEventListener("resize", debounce(() => resize(), 100));
|
window.addEventListener("resize", debounce(() => resize(), 1000));
|
||||||
window.addEventListener("scroll", debounce(() => resize(), 100));
|
window.addEventListener("scroll", debounce(() => resize(), 1000));
|
||||||
return () => {
|
return () => {
|
||||||
window.removeEventListener("resize", debounce(() => resize(), 100));
|
window.removeEventListener("resize", debounce(() => resize(), 1000));
|
||||||
window.removeEventListener("scroll", debounce(() => resize(), 100));
|
window.removeEventListener("scroll", debounce(() => resize(), 1000));
|
||||||
if (oWebControl != null) {
|
if (oWebControl != null) {
|
||||||
oWebControl.JS_HideWnd(); // 先让窗口隐藏,规避可能的插件窗口滞后于浏览器消失问题
|
oWebControl.JS_HideWnd(); // 先让窗口隐藏,规避可能的插件窗口滞后于浏览器消失问题
|
||||||
oWebControl.JS_Disconnect().then(function () { // 断开与插件服务连接成功
|
oWebControl.JS_Disconnect().then(function () { // 断开与插件服务连接成功
|
||||||
|
Reference in New Issue
Block a user