Commit 197e220f authored by Oleg Dzhimiev's avatar Oleg Dzhimiev

1. +height change to js 2. switched to WPs versions of jquery-ui-draggable

parent e51bd9e5
...@@ -271,7 +271,11 @@ ...@@ -271,7 +271,11 @@
}); });
zoom_info.on("click",function(){ zoom_info.on("click",function(){
set_zoom(0,0,settings.width);
var z = settings.width/$("#display_window_0 .zoomable")[0].naturalWidth;
var height = z*$("#display_window_0 .zoomable")[0].naturalHeight;
set_zoom(0,0,settings.width,height);
}); });
elem.append(zoom_info); elem.append(zoom_info);
...@@ -292,7 +296,7 @@ ...@@ -292,7 +296,7 @@
//disable initial zoom //disable initial zoom
settings.zoom = 0; settings.zoom = 0;
set_zoom(i_top,i_left,i_width); set_zoom(i_top,i_left,i_width,i_height);
} }
update_zoom_info(); update_zoom_info();
...@@ -455,24 +459,26 @@ ...@@ -455,24 +459,26 @@
if (new_zoom==0) new_zoom = 0.05; if (new_zoom==0) new_zoom = 0.05;
new_width = new_zoom * old_width / old_zoom; new_width = new_zoom * old_width / old_zoom;
new_height = new_zoom * old_height / old_zoom;
k = new_width/old_width; k = new_width/old_width;
new_x = x-k*old_x; new_x = x-k*old_x;
new_y = y-k*old_y; new_y = y-k*old_y;
set_zoom(new_y,new_x,new_width); set_zoom(new_y,new_x,new_width,new_height);
} }
function set_zoom(top,left,width){ function set_zoom(top,left,width,height){
$(".display_window").each(function(){ $(".display_window").each(function(){
var tmp_elem = $(this).find(".zoomable"); var tmp_elem = $(this).find(".zoomable");
tmp_elem.css({ tmp_elem.css({
top: top+"px", top: top+"px",
left: left-$(this).position().left+"px", left: left-$(this).position().left+"px",
width: width+"px" width: width+"px",
height: height+"px"
}); });
}); });
update_zoom_info(); update_zoom_info();
...@@ -543,7 +549,7 @@ ...@@ -543,7 +549,7 @@
}(jQuery)); }(jQuery));
function touchHandler(event) { function touchHandler_not_used(event) {
var touch = event.changedTouches[0]; var touch = event.changedTouches[0];
var simulatedEvent = document.createEvent("MouseEvent"); var simulatedEvent = document.createEvent("MouseEvent");
...@@ -562,7 +568,7 @@ function touchHandler(event) { ...@@ -562,7 +568,7 @@ function touchHandler(event) {
} }
function init_touch(element) { function init_touch_not_used(element) {
document.addEventListener("touchstart", touchHandler, true); document.addEventListener("touchstart", touchHandler, true);
document.addEventListener("touchmove", touchHandler, true); document.addEventListener("touchmove", touchHandler, true);
document.addEventListener("touchend", touchHandler, true); document.addEventListener("touchend", touchHandler, true);
......
...@@ -22,11 +22,8 @@ ...@@ -22,11 +22,8 @@
function sravnitel_enqueue_script($hook){ function sravnitel_enqueue_script($hook){
wp_enqueue_style( 'style1', SRAVNITEL_URL.'/assets/css/sravnitel.css'); wp_enqueue_style( 'sravnitel-style', SRAVNITEL_URL.'/assets/css/sravnitel.css');
wp_enqueue_script( 'sravnitel', SRAVNITEL_URL.'/assets/js/jquery.sravnitel.js', array('jquery-ui-draggable'));
//wp_enqueue_script( 'script1', SRAVNITEL_URL.'/assets/js/jquery-3.1.1.js', array( 'jquery' ));
wp_enqueue_script( 'script2', SRAVNITEL_URL.'/assets/js/jquery.sravnitel.js', array( 'jquery' ));
wp_enqueue_script( 'script3', SRAVNITEL_URL.'/assets/js/jquery-ui-1.12.1/jquery-ui.js', array( 'jquery' ));
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment