Permalink
Browse files

* Speed up mousewheel scrolling proportionally.

  Thanks to @artem++ for the suggestion.
  • Loading branch information...
1 parent b05b5b2 commit 670fbe23f8380f28fe4e3c64f502edbf4abc820b @audreyt committed Feb 13, 2013
Showing with 5 additions and 5 deletions.
  1. +2 −2 SocialCalcModule.js
  2. +2 −2 socialcalctableeditor.js
  3. +1 −1 static/ethercalc.js
View
4 SocialCalcModule.js
@@ -9069,10 +9069,10 @@ SocialCalc.EditorProcessMouseWheel = function(event, delta, mousewheelinfo, wobj
if (wobj.functionobj.editor.busy) return; // ignore if busy
if (delta > 0) {
- wobj.functionobj.editor.ScrollRelative(true, -1);
+ wobj.functionobj.editor.ScrollRelative(true, Math.floor(-delta));
}
if (delta < 0) {
- wobj.functionobj.editor.ScrollRelative(true, +1);
+ wobj.functionobj.editor.ScrollRelative(true, Math.ceil(-delta));
}
}
View
4 socialcalctableeditor.js
@@ -2146,10 +2146,10 @@ SocialCalc.EditorProcessMouseWheel = function(event, delta, mousewheelinfo, wobj
if (wobj.functionobj.editor.busy) return; // ignore if busy
if (delta > 0) {
- wobj.functionobj.editor.ScrollRelative(true, -1);
+ wobj.functionobj.editor.ScrollRelative(true, Math.floor(-delta));
}
if (delta < 0) {
- wobj.functionobj.editor.ScrollRelative(true, +1);
+ wobj.functionobj.editor.ScrollRelative(true, Math.ceil(-delta));
}
}
View
2 static/ethercalc.js
@@ -322,7 +322,7 @@ SocialCalc.EditorAddToInput=function(a,c,b){var d=a.workingvalues;if(!a.noEdit&&
"",a.RangeRemove(),a.MoveECell(d.ecoord)),a.inputBox.SetText(a.inputBox.GetText()+c)}};SocialCalc.EditorDisplayCellContents=function(a){a.inputBox&&a.inputBox.DisplayCellContents()};
SocialCalc.EditorSaveEdit=function(a,c){var b,d,e;b=a.context.sheetobj;var f=a.workingvalues;e="string"==typeof c?c:a.inputBox.GetText();b=SocialCalc.GetCellContents(b,f.ecoord)+"";e!=b&&(b=e.charAt(0),"="==b&&-1==e.indexOf("\n")?(d="formula",e=e.substring(1)):"'"==b?(d="text t",e=e.substring(1),b=SocialCalc.DetermineValueType(e),"t"==b.type.charAt(0)&&(d="text "+b.type)):0==e.length?d="empty":(b=SocialCalc.DetermineValueType(e),d="n"==b.type&&e==b.value+""?"value n":"t"==b.type.charAt(0)?"text "+
b.type:""==b.type?"text t":"constant "+b.type+" "+b.value),"t"==d.charAt(0)&&(e=SocialCalc.encodeForSave(e)),e="set "+f.ecoord+" "+d+" "+e,a.EditorScheduleSheetCommands(e,!0,!1))};SocialCalc.EditorApplySetCommandsToRange=function(a,c){var b;b=a.ecell;var d=a.range;d.hasrange?(coord=SocialCalc.crToCoord(d.left,d.top)+":"+SocialCalc.crToCoord(d.right,d.bottom),b="set "+coord+" "+c):b="set "+b.coord+" "+c;a.EditorScheduleSheetCommands(b,!0,!1);a.DisplayCellContents()};
-SocialCalc.EditorProcessMouseWheel=function(a,c,b,d){d.functionobj.editor.busy||(0<c&&d.functionobj.editor.ScrollRelative(!0,-1),0>c&&d.functionobj.editor.ScrollRelative(!0,1))};
+SocialCalc.EditorProcessMouseWheel=function(a,c,b,d){d.functionobj.editor.busy||(0<c&&d.functionobj.editor.ScrollRelative(!0,Math.floor(-c)),0>c&&d.functionobj.editor.ScrollRelative(!0,Math.ceil(-c)))};
SocialCalc.GridMousePosition=function(a,c,b){var d,e,f={};for(d=1;d<a.rowpositions.length&&!(a.rowheight[d]&&a.rowpositions[d]+a.rowheight[d]>b);d++);for(e=1;e<a.colpositions.length&&!(a.colwidth[e]&&a.colpositions[e]+a.colwidth[e]>c);e++);f.row=d;f.col=e;if(a.headposition){if(c<a.headposition.left&&c>=a.gridposition.left){f.rowheader=!0;f.distance=a.headposition.left-c;f.rowtounhide="";if(unhide=a.context.rowunhidetop[d])pos=SocialCalc.GetElementPosition(unhide),c>=pos.left&&(c<pos.left+unhide.offsetWidth&&
b>=pos.top&&b<pos.top+unhide.offsetHeight)&&(f.rowtounhide=d+1);if(unhide=a.context.rowunhidebottom[d])pos=SocialCalc.GetElementPosition(unhide),c>=pos.left&&(c<pos.left+unhide.offsetWidth&&b>=pos.top&&b<pos.top+unhide.offsetHeight)&&(f.rowtounhide=d-1)}else if(b<a.headposition.top&&b>a.gridposition.top){f.colheader=!0;f.distance=a.headposition.top-b;f.coltoresize=e-(a.colpositions[e]+a.colwidth[e]/2>c?1:0)||1;if(unhide=a.context.colunhideleft[e])pos=SocialCalc.GetElementPosition(unhide),c>=pos.left&&
(c<pos.left+unhide.offsetWidth&&b>=pos.top&&b<pos.top+unhide.offsetHeight)&&(f.coltounhide=e+1);if(unhide=a.context.colunhideright[e])pos=SocialCalc.GetElementPosition(unhide),c>=pos.left&&(c<pos.left+unhide.offsetWidth&&b>=pos.top&&b<pos.top+unhide.offsetHeight)&&(f.coltounhide=e-1);for(c=0;c<a.context.colpanes.length;c++)if(f.coltoresize>=a.context.colpanes[c].first&&f.coltoresize<=a.context.colpanes[c].last)return f;delete f.coltoresize}else c>=a.verticaltablecontrol.controlborder?(f.rowfooter=

0 comments on commit 670fbe2

Please sign in to comment.