From 90576c77292bd78b1a685d5c492cd41f7b8b94c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc?= Date: Tue, 12 Sep 2017 10:56:06 +0200 Subject: [PATCH] prevent image change size on refresh issue --- core/template/dashboard/camera.html | 11 ++++++++++- core/template/mobile/camera.html | 12 +++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/core/template/dashboard/camera.html b/core/template/dashboard/camera.html index a2246e57..05582852 100644 --- a/core/template/dashboard/camera.html +++ b/core/template/dashboard/camera.html @@ -67,6 +67,9 @@ $(".md_cameraZoom[data-eqLogic_uid=#uid#]").dialog("open"); }); +maxWidth_#id#_thumbnail = 0; +maxWidth_#id# = 0; + function refreshImgCam#id#(){ if($('.eqLogic[data-eqLogic_uid=#uid#]').html() == undefined){ return; @@ -79,7 +82,13 @@ var start = Date.now(); var url = "#url#"; url += (url.indexOf('?') > 0) ? '&t='+(new Date()).getTime() : '?t='+(new Date()).getTime(); - url += (thumbnail)? '&thumbnail=1&width='+ $('.eqLogic[data-eqLogic_id=#id#] .directDisplay img').css('max-width').replace('px',''):'&width='+$(".md_cameraZoom[data-eqLogic_id=#id#] .display img").width(); + if(maxWidth_#id#_thumbnail < $('.eqLogic[data-eqLogic_id=#id#] .directDisplay img').css('max-width').replace('px','')){ + maxWidth_#id#_thumbnail = $('.eqLogic[data-eqLogic_id=#id#] .directDisplay img').css('max-width').replace('px',''); + } + if(maxWidth_#id# < $(".md_cameraZoom[data-eqLogic_id=#id#] .display img").width()){ + maxWidth_#id# = $(".md_cameraZoom[data-eqLogic_id=#id#] .display img").width(); + } + url += (thumbnail) ? '&thumbnail=1&width='+ maxWidth_#id#_thumbnail:'&width='+maxWidth_#id#; var img = new Image(); img.src = url; diff --git a/core/template/mobile/camera.html b/core/template/mobile/camera.html index 731fd5ab..281bf3c9 100644 --- a/core/template/mobile/camera.html +++ b/core/template/mobile/camera.html @@ -51,6 +51,9 @@

#name_display#

refreshImgCam#id#(); } ); + maxWidth_#id#_thumbnail = 0; + maxWidth_#id# = 0; + function refreshImgCam#id#(){ if($('.eqLogic[data-eqLogic_uid=#uid#]').html() == undefined){ return; @@ -63,7 +66,14 @@

#name_display#

var start = Date.now(); var url = "#url#"; url += (url.indexOf('?') > 0) ? '&t='+(new Date()).getTime() : '?t='+(new Date()).getTime(); - url += (thumbnail)? '&thumbnail=1&width='+ $('.eqLogic[data-eqLogic_id=#id#] img.directDisplay').width():'&width='+ (deviceInfo.width - 50); + + if(maxWidth_#id#_thumbnail < $('.eqLogic[data-eqLogic_id=#id#] img.directDisplay').width()){ + maxWidth_#id#_thumbnail = $('.eqLogic[data-eqLogic_id=#id#] img.directDisplay').width(); + } + if(maxWidth_#id# < (deviceInfo.width-50)){ + maxWidth_#id# = (deviceInfo.width-50); + } + url += (thumbnail)? '&thumbnail=1&width='+ maxWidth_#id#:'&width='+maxWidth_#id#; url += '&mobile=1'; var img = new Image();