Nested SingleChildScrollView - scroll

I have a widget with nested SingleChildScrollView in SingleChildScrollView. It is possible to scroll down outer scroller when inner scroller reaches bottom and scroll up when inner one reaches top.

SingleChildScrollView has a property called physics. Set physics to SingleChildScrollView() as shown below:
SingleChildScrollView(
physics:NeverScrollableScrollPhysics(),
)

Related

Scroll one page to the right in Cypress

How could I scroll one page to the right in Cypress?
E.g. I have a horizontally scrollable area. The area contains elements a, b and if I scroll to the right a and b get destroyed, while c and d get added.
My attempt is to find out the width of the scrollable view and then scroll that amount to the right. But the width does not get retrieved before the scrollTo gets called.
Here is what I am trying to do:
const width = cy.getCy("scroll-viewport").invoke("width");
cy.getCy("scroll-viewport").scrollTo(width, 0);
Your code sample has some mystery about it, for example what is cy.getCy().
I can show you how to do it with standard code, and you can adapt from there.
Assuming scroll-viewport is a selector for the scroll container (the owner of the scroll bar)
cy.get("scroll-viewport").then($scrollContainer => {
const width = $scrollContainer[0].offsetWidth;
$scrollContainer[0].scrollTo(width, 0);
})
Note $scrollContainer[0].scrollWidth gives you the total width after scrolling, in case you need that.

Why are my grid-spans getting extra margins?

Using the Singularity Grid System:
I have a nested grid. Nothing fancy, just 2 column. Code is like this:
main-content { #include grid-span(8,1); }
sidebar { #include grid-span(4,9); }
It renders fine, but I keep getting undesired margins. The main content has a small margin-left and the sidebar has a small margin-right. I want these to have zero margins on the edge, similar to declaring main-content as "alpha" and sidebar as "omega."
Here is the CSS (at full desktop width):
main-content { width: 65%;float: left;margin-right: -100%;margin-left: 0.83333%;clear: none;}
sidebar-first {width: 31.66667%;float: right;margin-left: 0;margin-right: 0.83333%;clear:none;}
I didn't think this was default Singularity behavior, to add those small margins on the outer edges of my grid. Or is it? Can I get around it somehow? (besides just manually adding margin-left:0 and margin-right:0). Of course if there's margin on the outer edges, the total width of each DIV should increase as well (e.g. - for the main-content, instead of 65%, it'd be 65.83333)

Resize all uiscrollviews in a container uiscrollview

Hierarchy is a fullscreen landscape container UIScroll. Inside are multiple fullscreen pages made up of uiscrollviews with images inside - this allows paging plus pinching /zooming of the inner scrollviews. You can scroll up and down.
I want to resize the width of the container scrollview and have the nested uiscrolls and images within them resize proportionally and dynamically to the new width and height.
My outer scroll has autoresize to yes, my inner scrolls have the same. And I also have my uiimageviews on auto as well.
Right now the frame of the container scroll just crops off the inner content.
Any thoughts?
I ended up adding code to a function that allowed me to scale the interior of the scrollview the way I wanted.
[containerscrollView setFrame:CGRectMake(200.0f, 0.0f, 800.0f, 768.0f)];
containerscrollView.contentSize = CGSizeMake(800,containerscrollView.frame.size.height * scrollArrayCount);
for (UIScrollView *tmp in [containerscrollView subviews]) {
if (tmp.tag>4000) // make sure to only resize the inner scrollview {
[tmp setFrame:CGRectMake(tmp.frame.origin.x, tmp.frame.origin.y, 800.0f, 768.0f)];
_innerScrollView.contentSize =CGSizeMake(800.0f, 768.0f);
}
}

ObjectAnimator in Android doesn't update the View's parent

Objective:
Build a SlideUp animation in a ImageView with fixed height that is placed in a LinearLayout with wrap_content height.
Problem:
The animation runs normally, but the parent LinearLayout doesn't resize itself while or after the animation occurs. I mean, if it is set to "wrap_content" and the "content" changes it's position (y axis to -100), it's expected that the parent accompanies the animation, "animating" it's height to 0 as well, or not?
How can I force it to continue "wraping" the content while the animation runs?
PS: No, it's not about fillAfter, I'm using ObjectAnimator, which changes the real object properties, not only the View drawn. For instance, the click event is not being triggered on the place the image used to be before the animation.
My code:
ObjectAnimator oa = ObjectAnimator.ofFloat(findViewById(R.id.menu_tile_image), "y", 0, -100);
Layout structure:
LinearLayout (match_parent, wrap_content) > ImageView (fill_parent, 100)
Any clue on that? Thanks!

FabricJS Canvas, Scrolling parent container moves child hit area

I am using FabricJS to create an application. I am finding that scrolling a parent div/container offsets the selectable area of an object to the right in direct relation to amount scrolled.
So, if I have a canvas that is 1200x600 and a container div that is 600x600 and I add a rect to that canvas at 400, 120; when I scroll 200px, I can't click on the rect to select it. Rather, I have to move my mouse to 600, 120 (empty space) to get the cross bar and select the rect.
Not sure if this is known, or has a work around - but I would appreciate any help possible.
You'll have to modify FabricJs code to make it work.
The problem is in the getPointer function, if you search for it in all.js you'll notice the comment "this method needs fixing" from kangax.
A workaround can be substituting this function with
function getPointer(event) {
// TODO (kangax): this method needs fixing
return { x: pointerX(event) + document.getElementById("container").scrollLeft, y: pointerY(event) + document.getElementById("container").scrollTop };
}
where "container" is the wrapper div of you canvas. It's not nice, since you have to put the exact id, but it works.
Hope this helps.

Resources