2D-scrollable View?

You must Login before you can answer or comment on any questions.

Hi Titanians,

for displaying of table I'am looking for 2D scrollable view: wiping vertical goes in colums, wiping horizontal walk thrue rows. If I'am using scroll view I have no pagination …

Any ideas?

Rainer

2 Answers

maybe vertical (rotated)scrollable views, in horizontal scrollalbe view. its possible you need a few trick with gesture events :)

I have solved in this manner:

var touchpos = {};
    var oldpos = {
        x : 0,
        y : 0
    };
    2dview.addEventListener('dragEnd', function(e) {
        var currentpos = {
            x : sv.contentOffset.x,
            y : sv.contentOffset.y
        };
        var nextpos = {};
        var xstep = (Math.abs(currentpos.x - oldpos.x) > Math.abs(currentpos.y - oldpos.y)) ? true : false;
        var ystep = (Math.abs(currentpos.x - oldpos.x) < Math.abs(currentpos.y - oldpos.y)) ? true : false;
        if(currentpos.x < 0 || currentpos.x > 11 * width)
            xstep = false;
        if(currentpos.y < 0)
            ystep = false;
        if(currentpos.x >= oldpos.x) {
            nextpos.x = (xstep) ? oldpos.x + width : oldpos.x;
        }
        if(currentpos.x < oldpos.x) {
            nextpos.x = (xstep) ? oldpos.x - width : oldpos.x;
        }
        if(currentpos.y >= oldpos.y) {
            nextpos.y = (ystep) ? oldpos.y + height : oldpos.y
        }
        if(currentpos.y < oldpos.y) {
            nextpos.y = (ystep) ? oldpos.y - height : oldpos.y;
        }
 
        oldpos.x = nextpos.x;
        oldpos.y = nextpos.y;
 
        sv.scrollTo(nextpos.x, nextpos.y);
        var col = Math.ceil(oldpos.x / width);
        var row = Math.ceil(oldpos.y / height);
    });

Your Answer

Think you can help? Login to answer this question!