Thread
#compose
    Cicero

    Cicero

    1 year ago
    So I’ve been doing some playing around with this grid and I wanted it to move around X and Y. To try to make this happen I draw gridSize+2 and I made the offset X and Y - 1 (so we have this extra 1 in every border -x/x/-y/y). Now when I’m animating I slide the offSet X or Y into the direction I want (minus or positive), after the animation of offset ends I update the logical position and then redraw the grid back to offset 0, whatever X or Y direction I moved. My issue is that I can’t get to draw my columns out of my screen bounds. Is this a limitation that I can get around?
    Tested using this
    Row (Modifier.offset(x = (pos.x * -5).dp, y = (pos.y * -5).dp)){
        repeat(20){
            Box(
                Modifier
                    .width(100.dp)
                    .height(100.dp)
                    .background(if(it%2 == 1)Color.Blue else Color.Red)
            )
        }
    }
    And yes, if you update offset X or Y and you draw something out of bounds it doesn’t repaint the thing
    Nothing to do with offset, it’s something to do with the view bounds
    Can I fake bigger view bounds?
    Because offset doesn’t change the component size my component is cropped. But it’s funny, should this happen even then I hard coded width to 3000.dp?
    I can’t use padding 😕 I wanna go negative. Would there be a way to make a component bigger than the screen/view and move it around using offset?
    I will push this a little further if it doesn’t work I’m going Canvas 😞