Commit 73d508e8 authored by Alexander.Trofimov's avatar Alexander.Trofimov Committed by Alexander.Trofimov

create scroll bars from jquery to javascript

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@53411 954022d7-b5bf-4e40-9824-e11837661b57
parent e2fcb13f
...@@ -215,13 +215,13 @@ ...@@ -215,13 +215,13 @@
if (isVert || isHoriz) { if (isVert || isHoriz) {
this.handlers.trigger("reinitializeScroll", whichSB, function (vSize, hSize) { this.handlers.trigger("reinitializeScroll", whichSB, function (vSize, hSize) {
if (isVert) { if (isVert) {
var vsHelperH = self.vsb.outerHeight() + Math.max(vSize * opt.vscrollStep, 1); var vsHelperH = $(self.vsb).outerHeight() + Math.max(vSize * opt.vscrollStep, 1);
self.vsb.find("#ws-v-scroll-helper").height(vsHelperH); $(self.vsb).find("#ws-v-scroll-helper").height(vsHelperH);
self.vsbApi.Reinit(opt, opt.vscrollStep * ws.getFirstVisibleRow(/*allowPane*/true)); self.vsbApi.Reinit(opt, opt.vscrollStep * ws.getFirstVisibleRow(/*allowPane*/true));
} }
if (isHoriz) { if (isHoriz) {
var hsHelperW = self.hsb.outerWidth() + Math.max(hSize * opt.hscrollStep, 1); var hsHelperW = $(self.hsb).outerWidth() + Math.max(hSize * opt.hscrollStep, 1);
self.hsb.find("#ws-h-scroll-helper").width(hsHelperW); $(self.hsb).find("#ws-h-scroll-helper").width(hsHelperW);
self.hsbApi.Reinit(opt, opt.vscrollStep * ws.getFirstVisibleCol(/*allowPane*/true)); self.hsbApi.Reinit(opt, opt.vscrollStep * ws.getFirstVisibleCol(/*allowPane*/true));
} }
}); });
...@@ -288,19 +288,19 @@ ...@@ -288,19 +288,19 @@
_createScrollBars: function () { _createScrollBars: function () {
var self = this, opt = this.settings; var self = this, opt = this.settings;
var widget = $(this.widget);
// vertical scroll bar // vertical scroll bar
this.vsb = widget.find("#ws-v-scrollbar"); this.vsb = document.createElement('div');
if (this.vsb.length < 1) { this.vsb.id = "ws-v-scrollbar";
this.vsb = $('<div id="ws-v-scrollbar"><div id="ws-v-scroll-helper"/></div>').appendTo(widget); this.vsb.innerHTML = '<div id="ws-v-scroll-helper"></div>';
} this.widget.appendChild(this.vsb);
if (!this.vsbApi) { if (!this.vsbApi) {
this.vsbApi = new ScrollObject( this.vsb[0].id,opt); this.vsbApi = new ScrollObject(this.vsb.id, opt);
this.vsbApi.bind("scrollvertical",function(evt){ this.vsbApi.bind("scrollvertical", function(evt) {
self.handlers.trigger("scrollY", evt.scrollPositionY / opt.vscrollStep); self.handlers.trigger("scrollY", evt.scrollPositionY / opt.vscrollStep);
}); });
this.vsbApi.bind("scrollVEnd",function(evt){ this.vsbApi.bind("scrollVEnd", function(evt) {
self.handlers.trigger("addRow",true); self.handlers.trigger("addRow",true);
}); });
this.vsbApi.onLockMouse = function(){ this.vsbApi.onLockMouse = function(){
...@@ -318,16 +318,17 @@ ...@@ -318,16 +318,17 @@
} }
// horizontal scroll bar // horizontal scroll bar
this.hsb = widget.find("#ws-h-scrollbar"); this.hsb = document.createElement('div');
if (this.hsb.length < 1) { this.hsb.id = "ws-h-scrollbar";
this.hsb = $('<div id="ws-h-scrollbar"><div id="ws-h-scroll-helper"/></div>').appendTo(widget); this.hsb.innerHTML = '<div id="ws-h-scroll-helper"></div>';
} this.widget.appendChild(this.hsb);
if (!this.hsbApi) { if (!this.hsbApi) {
this.hsbApi = new ScrollObject( this.hsb[0].id, $.extend(true, {}, opt, {wheelScrollLines: 1})); this.hsbApi = new ScrollObject(this.hsb.id, $.extend(true, {}, opt, {wheelScrollLines: 1}));
this.hsbApi.bind("scrollhorizontal",function(evt){ this.hsbApi.bind("scrollhorizontal",function(evt) {
self.handlers.trigger("scrollX", evt.scrollPositionX / opt.hscrollStep); self.handlers.trigger("scrollX", evt.scrollPositionX / opt.hscrollStep);
}); });
this.hsbApi.bind("scrollHEnd",function(evt){ this.hsbApi.bind("scrollHEnd",function(evt) {
self.handlers.trigger("addColumn",true); self.handlers.trigger("addColumn",true);
}); });
this.hsbApi.onLockMouse = function(){ this.hsbApi.onLockMouse = function(){
...@@ -345,9 +346,9 @@ ...@@ -345,9 +346,9 @@
} }
// right bottom corner // right bottom corner
if (widget.find("#ws-scrollbar-corner").length < 1) { var corner = document.createElement('div');
$('<div id="ws-scrollbar-corner"/>').appendTo(widget); corner.id = "ws-scrollbar-corner";
} this.widget.appendChild(corner);
}, },
/** /**
......
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