Skip to content

Commit

Permalink
prevent image change size on refresh issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Loïc committed Sep 12, 2017
1 parent da1292e commit 90576c7
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
11 changes: 10 additions & 1 deletion core/template/dashboard/camera.html
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
12 changes: 11 additions & 1 deletion core/template/mobile/camera.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ <h1 class='nd-title'>#name_display#</h1>
refreshImgCam#id#();
} );

maxWidth_#id#_thumbnail = 0;
maxWidth_#id# = 0;

function refreshImgCam#id#(){
if($('.eqLogic[data-eqLogic_uid=#uid#]').html() == undefined){
return;
Expand All @@ -63,7 +66,14 @@ <h1 class='nd-title'>#name_display#</h1>
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();
Expand Down

0 comments on commit 90576c7

Please sign in to comment.