1
0
mirror of https://github.com/MatMoul/quickdial-webext.git synced 2024-12-23 15:36:12 +00:00

Bug: drag-drop on second and next page

This commit is contained in:
MatMoul 2017-10-05 22:06:09 +02:00
parent 5f6d1df70d
commit 1431c5edfe

View File

@ -196,7 +196,10 @@ dial.initGrid = function(name, settings, container){
link.onmousedown = function(){ dial._selectedItem = this; }; link.onmousedown = function(){ dial._selectedItem = this; };
function dragstart_handler(ev) { function dragstart_handler(ev) {
ev.dataTransfer.setData("text/plain", ev.target.parentElement.getAttribute('gridindex')); var index = (dial.page - 1) * (app.settings.grid.rows * app.settings.grid.columns) + +(ev.target.parentElement.getAttribute('gridindex'));
if(settings.cells.backPanel && dial.path) index -= dial.page;
console.log(index);
ev.dataTransfer.setData("text/plain", index);
} }
function dragover_handler(ev) { function dragover_handler(ev) {
ev.preventDefault(); ev.preventDefault();
@ -208,14 +211,11 @@ dial.initGrid = function(name, settings, container){
var StartIndex = ev.dataTransfer.getData("text"); var StartIndex = ev.dataTransfer.getData("text");
var EndIndex = 0; var EndIndex = 0;
if(ev.target.tagName == 'DIV'){ if(ev.target.tagName == 'DIV'){
EndIndex = ev.target.parentElement.parentElement.getAttribute('gridindex') EndIndex = (dial.page - 1) * (app.settings.grid.rows * app.settings.grid.columns) + +(ev.target.parentElement.parentElement.getAttribute('gridindex'));
} else{ } else{
EndIndex = ev.target.getAttribute('gridindex'); EndIndex =(dial.page - 1) * (app.settings.grid.rows * app.settings.grid.columns) + +(ev.target.getAttribute('gridindex'));
}
if(settings.cells.backPanel && dial.path){
StartIndex-=1;
EndIndex-=1;
} }
if(settings.cells.backPanel && dial.path) EndIndex -= dial.page;
app.setNodeIndex(dial.Node, StartIndex, EndIndex); app.setNodeIndex(dial.Node, StartIndex, EndIndex);
} }
link.draggable = true; link.draggable = true;