Commit a6d14824 authored by Alexander.Trofimov's avatar Alexander.Trofimov Committed by Alexander.Trofimov

Поправил баг с бесконечным скроллом в всплывающем списке формул (Баг...

Поправил баг с бесконечным скроллом в всплывающем списке формул (Баг http://bugzserver/show_bug.cgi?id=24606)
refactoring

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@56564 954022d7-b5bf-4e40-9824-e11837661b57
parent e3a02c0f
This diff is collapsed.
...@@ -383,12 +383,12 @@ DrawingObjectsController.prototype.isPointInDrawingObjects = function(x, y, e) ...@@ -383,12 +383,12 @@ DrawingObjectsController.prototype.isPointInDrawingObjects = function(x, y, e)
var ret = this.curState.onMouseDown(e || {}, x, y); var ret = this.curState.onMouseDown(e || {}, x, y);
this.handleEventMode = HANDLE_EVENT_MODE_HANDLE; this.handleEventMode = HANDLE_EVENT_MODE_HANDLE;
return ret; return ret;
} };
DrawingObjectsController.prototype.handleDoubleClickOnChart = function(chart) DrawingObjectsController.prototype.handleDoubleClickOnChart = function(chart)
{ {
this.changeCurrentState(new NullState()); this.changeCurrentState(new NullState());
} };
DrawingObjectsController.prototype.addImageFromParams = function(rasterImageId, x, y, extX, extY) DrawingObjectsController.prototype.addImageFromParams = function(rasterImageId, x, y, extX, extY)
{ {
...@@ -401,7 +401,7 @@ DrawingObjectsController.prototype.addImageFromParams = function(rasterImageId, ...@@ -401,7 +401,7 @@ DrawingObjectsController.prototype.addImageFromParams = function(rasterImageId,
this.selectObject(image, 0); this.selectObject(image, 0);
image.addToRecalculate(); image.addToRecalculate();
this.startRecalculate(); this.startRecalculate();
} };
DrawingObjectsController.prototype.isViewMode= function() DrawingObjectsController.prototype.isViewMode= function()
{ {
......
...@@ -18,16 +18,15 @@ ...@@ -18,16 +18,15 @@
this.handlers = new asc_HL(handlers); this.handlers = new asc_HL(handlers);
this.scrollOptions = { this.scrollOptions = {
wheelSpeed : 20,
wheelPropagation : false, wheelPropagation : false,
minScrollbarLength : 50, minScrollbarLength : null,
useBothWheelAxes : false, useBothWheelAxes : false,
useKeyboard : true, useKeyboard : true,
suppressScrollX : false, suppressScrollX : false,
suppressScrollY : false, suppressScrollY : false,
scrollXMarginOffset : 5, scrollXMarginOffset : 5,
scrollYMarginOffset : 5, scrollYMarginOffset : 40,
includePadding : true includePadding : false
}; };
this.element = element; this.element = element;
...@@ -61,19 +60,19 @@ ...@@ -61,19 +60,19 @@
this.selector.innerHTML = '<ul id="apiPopUpList" class="dropdown-menu"></ul>'; this.selector.innerHTML = '<ul id="apiPopUpList" class="dropdown-menu"></ul>';
this.element.appendChild(this.selector); this.element.appendChild(this.selector);
this.selectorList = document.getElementById("apiPopUpList"); this.selectorList = document.getElementById('apiPopUpList');
this.fMouseDown = function (event) {t._onMouseDown(event);}; this.fMouseDown = function (event) {t._onMouseDown(event);};
this.fMouseDblClick = function (event) {t._onMouseDblClick(event);}; this.fMouseDblClick = function (event) {t._onMouseDblClick(event);};
this.fMouseOver = function (event) {t._onMouseOver(event);}; this.fMouseOver = function (event) {t._onMouseOver(event);};
if (this.selector.addEventListener) { if (this.selector.addEventListener) {
this.selector.addEventListener("mousedown", function () { this.selector.addEventListener('mousedown', function () {
t.skipClose = true; t.skipClose = true;
}, false); }, false);
} }
if (window.addEventListener) { if (window.addEventListener) {
window.addEventListener("mousedown", function () { window.addEventListener('mousedown', function () {
if (t.skipClose) { if (t.skipClose) {
t.skipClose = false; t.skipClose = false;
return; return;
...@@ -98,7 +97,7 @@ ...@@ -98,7 +97,7 @@
var item, isFirst, value, selectElement = null; var item, isFirst, value, selectElement = null;
for (var i = 0; i < arrItems.length; ++i) { for (var i = 0; i < arrItems.length; ++i) {
item = document.createElement("li"); item = document.createElement('li');
isFirst = (0 === i); isFirst = (0 === i);
if (isFirst) if (isFirst)
this.firstElement = item; this.firstElement = item;
...@@ -108,18 +107,18 @@ ...@@ -108,18 +107,18 @@
selectElement = item; selectElement = item;
value = arrItems[i].name; value = arrItems[i].name;
item.setAttribute("title", arrItems[i].arg); item.setAttribute('title', arrItems[i].arg);
} else } else
value = arrItems[i]; value = arrItems[i];
item.innerHTML = "<a>" + value + "</a>"; item.innerHTML = '<a>' + value + '</a>';
item.setAttribute("val", value); item.setAttribute('val', value);
if (item.addEventListener) { if (item.addEventListener) {
item.addEventListener("mousedown" , this.fMouseDown , false); item.addEventListener('mousedown' , this.fMouseDown , false);
item.addEventListener("dblclick" , this.fMouseDblClick , false); item.addEventListener('dblclick' , this.fMouseDblClick , false);
if (!this.isFormula) { if (!this.isFormula) {
item.addEventListener("mouseover", this.fMouseOver, false); item.addEventListener('mouseover', this.fMouseOver, false);
} }
} }
...@@ -127,18 +126,6 @@ ...@@ -127,18 +126,6 @@
this.selectorListEl.push(item); this.selectorListEl.push(item);
} }
// Selection hack
/*var clearSelection = function() {
if (document.selection && document.selection.empty) {
document.selection.empty();
}
else if (window.getSelection) {
var sel = window.getSelection();
sel.removeAllRanges();
}
}*/
// TODO: В Mozilla избавиться от селекта текста при dblclick
// Для того, чтобы работал scroll // Для того, чтобы работал scroll
this.selectorListJQ.perfectScrollbar("update"); this.selectorListJQ.perfectScrollbar("update");
...@@ -156,8 +143,8 @@ ...@@ -156,8 +143,8 @@
} }
}; };
PopUpSelector.prototype.setPosition = function (cellRect) { PopUpSelector.prototype.setPosition = function (cellRect) {
this.selectorStyle["left"] = (cellRect.asc_getX() + 10) + "px"; this.selectorStyle['left'] = (cellRect.asc_getX() + 10) + 'px';
this.selectorStyle["top"] = (cellRect.asc_getY() + cellRect.asc_getHeight()) + "px"; this.selectorStyle['top'] = (cellRect.asc_getY() + cellRect.asc_getHeight()) + 'px';
}; };
PopUpSelector.prototype.getVisible = function () { PopUpSelector.prototype.getVisible = function () {
return this.isVisible; return this.isVisible;
...@@ -183,11 +170,11 @@ ...@@ -183,11 +170,11 @@
} else } else
retVal = true; retVal = true;
break; break;
case 13: // "enter" case 13: // Enter
if (!this.isFormula && null !== this.selectElement) { if (!this.isFormula && null !== this.selectElement) {
event.stopPropagation(); event.stopPropagation();
event.preventDefault(); event.preventDefault();
this._onInsert(this.selectElement.getAttribute("val")); this._onInsert(this.selectElement.getAttribute('val'));
} else } else
retVal = true; retVal = true;
break; break;
...@@ -214,7 +201,7 @@ ...@@ -214,7 +201,7 @@
PopUpSelector.prototype._onInsert = function (value) { PopUpSelector.prototype._onInsert = function (value) {
this.hide(); this.hide();
this.handlers.trigger("insert", value); this.handlers.trigger('insert', value);
}; };
PopUpSelector.prototype._onMouseDown = function (event) { PopUpSelector.prototype._onMouseDown = function (event) {
...@@ -223,7 +210,7 @@ ...@@ -223,7 +210,7 @@
if (this.isFormula) if (this.isFormula)
this._onChangeSelection(element); this._onChangeSelection(element);
else else
this._onInsert(element.getAttribute("val")); this._onInsert(element.getAttribute('val'));
}; };
PopUpSelector.prototype._onMouseDblClick = function (event) { PopUpSelector.prototype._onMouseDblClick = function (event) {
if (!this.isVisible) if (!this.isVisible)
...@@ -233,7 +220,7 @@ ...@@ -233,7 +220,7 @@
this._onMouseDown(event); this._onMouseDown(event);
return; return;
} }
var elementVal = (event ? event.currentTarget : this.selectElement).getAttribute("val") + "("; var elementVal = (event ? event.currentTarget : this.selectElement).getAttribute('val') + '(';
this._onInsert(elementVal); this._onInsert(elementVal);
}; };
PopUpSelector.prototype._onMouseOver = function (event) { PopUpSelector.prototype._onMouseOver = function (event) {
...@@ -243,14 +230,14 @@ ...@@ -243,14 +230,14 @@
this._onChangeSelection(event.currentTarget); this._onChangeSelection(event.currentTarget);
}; };
PopUpSelector.prototype._onChangeSelection = function (newElement) { PopUpSelector.prototype._onChangeSelection = function (newElement) {
if (null === newElement || null === newElement.getAttribute("val")) if (null === newElement || null === newElement.getAttribute('val'))
return; return;
if (null !== this.selectElement) if (null !== this.selectElement)
this.selectElement.className = ""; this.selectElement.className = '';
this.selectElement = newElement; this.selectElement = newElement;
this.selectElement.className = "selected"; this.selectElement.className = 'selected';
this.scrollToRecord(); this.scrollToRecord();
}; };
...@@ -261,7 +248,7 @@ ...@@ -261,7 +248,7 @@
var div = $(this.selectElement); var div = $(this.selectElement);
var div_top = div.offset().top; var div_top = div.offset().top;
if (div_top < inner_top || div_top+div.height() > inner_top + innerEl.height()) { if (div_top < inner_top || div_top + div.height() > inner_top + innerEl.height()) {
this.selectorListJQ.scrollTop(this.selectorListJQ.scrollTop() + div_top - inner_top); this.selectorListJQ.scrollTop(this.selectorListJQ.scrollTop() + div_top - inner_top);
} }
}; };
......
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