Skip to content

Commit 69dc985

Browse files
committed
Fixed an issue in the zoomer class where x1 could be less than x0 + some minor fixes in the same class.
1 parent 7a8b5cd commit 69dc985

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/ui-scripts/zoomer/zoomer.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ var Zoomer = function(model, zoomer_ele)
5454
this._last_update = 0;
5555

5656
if (zoomer_ele)
57-
this.set_zoomer_ele(zoomer_ele);
57+
this.set_zoomer_element(zoomer_ele);
5858
};
5959

6060
this._init();
@@ -66,7 +66,6 @@ var ZoomerPrototype = function()
6666

6767
this._set_up_zoomer_ele = function()
6868
{
69-
this._zoomer_ele.classList.add("zoomer-element");
7069
var zoomer_ele_style = window.getComputedStyle(this._zoomer_ele);
7170
this._zoomer_ele_ver_borders = parseInt(zoomer_ele_style.borderTopWidth) +
7271
parseInt(zoomer_ele_style.borderBottomWidth);
@@ -114,7 +113,7 @@ var ZoomerPrototype = function()
114113

115114
//
116115
// Zoomer element event handlers
117-
///
116+
//
118117

119118
this.zoomer_ele_onmousedown = function(event)
120119
{
@@ -207,7 +206,7 @@ var ZoomerPrototype = function()
207206

208207
//
209208
// Overlay element event handlers
210-
///
209+
//
211210

212211
this.overlay_ele_onmousedown = function(event)
213212
{
@@ -353,11 +352,12 @@ var ZoomerPrototype = function()
353352
}[event.which];
354353
if (!diff)
355354
return;
355+
356356
var is_left_handle = this._handler_ele == this._overlay_handle_left_ele;
357357
if (is_left_handle)
358-
this._overlay_left = Math.max(this._overlay_left - diff, 0);
358+
this._overlay_left = Math.max(Math.min(this._overlay_left - diff, this._to_right_x(this._overlay_right)), 0);
359359
else
360-
this._overlay_right = Math.max(this._overlay_right + diff, 0);
360+
this._overlay_right = Math.max(Math.min(this._overlay_right + diff, this._to_right_x(this._overlay_left)), 0);
361361
this._set_overlay_position();
362362
this._set_model_area();
363363
event.stopPropagation();

0 commit comments

Comments
 (0)