Skip to content
This repository was archived by the owner on Nov 25, 2020. It is now read-only.

Commit a5afbb4

Browse files
committed
Remove all touch events management, simply disable scroller replacement when on mobile context. Should fix scrolling and button issues on mobile.
1 parent a3509e7 commit a5afbb4

File tree

16 files changed

+35
-83
lines changed

16 files changed

+35
-83
lines changed

core/src/plugins/access.ajxp_home/class.UserDashboardHome.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,6 @@ Class.create("UserDashboardHome", AjxpPane, {
158158
switchToRepo(repoId);
159159
}
160160
};
161-
attachMobilTouchForClick(repoEl, select);
162161
disableTextSelection(repoEl);
163162
if(simpleClickOpen){
164163
repoEl.observe("click", function(e){

core/src/plugins/gui.ajax/res/js/ajaxplorer.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core/src/plugins/gui.ajax/res/js/ajaxplorer_boot.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core/src/plugins/gui.ajax/res/js/ajaxplorer_boot_protolegacy.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core/src/plugins/gui.ajax/res/js/lib/prototype/webfx.selectable.js

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -79,23 +79,6 @@ SelectableElements = Class.create({
7979
oElement.attachEvent("onclick", this._onclick);
8080
oElement.attachEvent("ondblclick", this._ondblclick);
8181
}
82-
if(addTouch){
83-
oElement.observe("touchstart", function(event){
84-
var touchData = event.changedTouches[0];
85-
oElement.selectableTouchStart = touchData["clientY"];
86-
}.bind(this));
87-
oElement.observe("touchend", function(event){
88-
if(oElement.selectableTouchStart) {
89-
var touchData = event.changedTouches[0];
90-
var delta = touchData['clientY'] - oElement.selectableTouchStart;
91-
if(Math.abs(delta) > 2){
92-
return;
93-
}
94-
}
95-
oElement.selectableTouchStart = null;
96-
this._onclick(event);
97-
}.bind(this) );
98-
}
9982

10083
this.eventMouseUp = this.dragEnd.bindAsEventListener(this);
10184
this.eventMouseDown = this.dragStart.bindAsEventListener(this);

core/src/plugins/gui.ajax/res/js/pydio/ui/class.AjxpPane.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,11 @@ Class.create("AjxpPane", {
8282
}.bind(this);
8383
document.observe("ajaxplorer:component_config_changed", this.configObserver);
8484

85+
if(this.options.replaceScroller && window.ajxpMobile){
86+
this.options.replaceScroller = false;
87+
this.htmlElement.setStyle({overflowY:"auto"});
88+
}
89+
8590
if(this.options.replaceScroller){
8691
this.scroller = new Element('div', {
8792
id:'scroller_'+this.htmlElement.id,

core/src/plugins/gui.ajax/res/js/pydio/ui/class.FilesList.js

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,10 @@ Class.create("FilesList", SelectableElements, {
7979
this._instanciatedToolbars = $A();
8080
}
8181
}
82-
if(this.options.fit && this.options.fit == "content"){
82+
if((this.options.fit && this.options.fit == "content") || window.ajxpMobile){
8383
this.options.replaceScroller = false;
8484
}
85+
8586
if(!FilesList.staticIndex) {
8687
FilesList.staticIndex = 1;
8788
}else{
@@ -731,11 +732,6 @@ Class.create("FilesList", SelectableElements, {
731732
paddingBottom: '0'
732733
}
733734
);
734-
if(this.options.horizontalScroll){
735-
attachMobileScroll(this.htmlElement, "horizontal");
736-
}else{
737-
attachMobileScroll(contentContainer, "vertical");
738-
}
739735
scrollElement = contentContainer;
740736
var oElement = this.htmlElement.down(".selectable_div");
741737

@@ -832,11 +828,6 @@ Class.create("FilesList", SelectableElements, {
832828
buffer = '<div class="panelHeader"><div style="float:right;padding-right:5px;font-size:1px;height:16px;"><input type="image" height="16" width="16" src="'+ajxpResourcesFolder+'/images/actions/16/zoom-in.png" id="slider-input-1" style="border:0px;width:16px;height:16px;margin-top:0px;padding:0px;" value="64"/></div>'+MessageHash[126]+'</div>';
833829
buffer += '<div id="selectable_div-'+this.__currentInstanceIndex+'" class="selectable_div'+(this._displayMode == "detail" ? ' detailed':'')+'" style="overflow:auto;">';
834830
this.htmlElement.update(buffer);
835-
if(this.options.horizontalScroll){
836-
attachMobileScroll(this.htmlElement, "horizontal");
837-
}else{
838-
attachMobileScroll(this.htmlElement.down(".selectable_div"), "vertical");
839-
}
840831
if(this.paginationData && parseInt(this.paginationData.get('total')) > 1 ){
841832
this.htmlElement.addClassName("paginated");
842833
this.htmlElement.down(".selectable_div").insert({before:this.createPaginator()});
@@ -919,7 +910,6 @@ Class.create("FilesList", SelectableElements, {
919910
if(parseInt(this.paginationData.get('total')) == 1) this._sortableTable.paginationLoaderFunc = null;
920911
}
921912

922-
923913
if(this.options.replaceScroller){
924914
this.scroller = new Element('div', {id:'filelist_scroller'+this.__currentInstanceIndex, className:'scroller_track', style:"right:0px"});
925915
this.scroller.insert('<div id="filelist_scrollbar_handle'+this.__currentInstanceIndex+'" class="scroller_handle"></div>');

core/src/plugins/gui.ajax/res/js/pydio/ui/class.FoldersTree.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Class.create("FoldersTree", AjxpPane, {
3535
{
3636
$super(oElement, options);
3737
this.treeContainer = new Element('div', {id:'tree_container', style:'overflow:auto;height:100%;width:100%;'});
38-
if(this.options.replaceScroller){
38+
if(this.options.replaceScroller){
3939
this.scroller = new Element('div', {id:'tree_scroller', className:'scroller_track', style:"right:"+(parseInt(oElement.getStyle("marginRight"))-parseInt(oElement.getStyle("paddingRight")))+"px"});
4040
this.scroller.insert('<div id="scrollbar_handle" class="scroller_handle"></div>');
4141
oElement.insert(this.scroller);

core/src/plugins/gui.ajax/res/js/pydio/ui/class.InfoPanel.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ Class.create("InfoPanel", AjxpPane, {
7878
* @param node
7979
*/
8080
open : function($super, node){
81+
// We should not have the observers
82+
document.stopObserving("ajaxplorer:actions_refreshed", this.updateHandler );
83+
document.stopObserving("ajaxplorer:component_config_changed", this.componentConfigHandler );
84+
document.stopObserving("ajaxplorer:user_logged", this.userLogHandler );
8185
this.htmlElement.up('div.dialogBox').setStyle({width:Math.min(450, document.viewport.getWidth())+'px'});
8286
this.htmlElement.up('div.dialogContent').setStyle({padding:0});
8387
this.htmlElement.down('#ip_content_info_panel').setStyle({position:"relative", top:0, left:0, width:'100%', height: Math.min(450, document.viewport.getHeight()-28)+'px', overflow:'auto'});

core/src/plugins/gui.ajax/res/js/pydio/util/ajxp_utils.js

Lines changed: 5 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -791,43 +791,11 @@ function scrollByTouch(event, direction, targetId){
791791
}
792792

793793
function attachMobileScroll(targetId, direction){
794-
if(!window.ajxpMobile) return;
795-
var target;
796-
if(typeof (targetId) == "string"){
797-
target = $(targetId);
798-
}else{
799-
target = targetId;
800-
targetId = target.id;
801-
if(!target.id){
802-
targetId = "scroll-pane-"+Math.floor(Math.random()*1000);
803-
target.setAttribute('id', targetId);
804-
}
805-
}
806-
if(!target) return;
807-
target.addEventListener("touchmove", function(event){ scrollByTouch(event, direction, targetId); });
808-
target.addEventListener("touchstart", function(event){ scrollByTouch(event, direction, targetId); });
809-
target.addEventListener("touchend", function(event){ scrollByTouch(event, direction, targetId); });
810-
}
811-
812-
function attachMobilTouchForClick(oElement, callback){
813-
814-
oElement.observe("touchstart", function(event){
815-
var touchData = event.changedTouches[0];
816-
oElement.selectableTouchStart = touchData["clientY"];
817-
});
818-
oElement.observe("touchend", function(event){
819-
if(oElement.selectableTouchStart) {
820-
var touchData = event.changedTouches[0];
821-
var delta = touchData['clientY'] - oElement.selectableTouchStart;
822-
if(Math.abs(delta) > 2){
823-
return;
824-
}
825-
}
826-
oElement.selectableTouchStart = null;
827-
callback(event);
828-
} );
829-
830-
794+
if(!window.ajxpMobile || !$(targetId)) return;
795+
var overflow = {};
796+
if(direction == 'vertical' || direction == 'both') overflow['overflowY'] = 'auto';
797+
if(direction == 'horizontal' || direction == 'both') overflow['overflowX'] = 'auto';
798+
$(targetId).setStyle(overflow);
831799
}
832800

833801
function bufferCallback(name, time, callback){

0 commit comments

Comments
 (0)