Comments (5)
I did figure out that I can do it by asking it in matrices:
var offset_x = flexScrollView._dataSource[id]._matrix[12];
var offset_y = flexScrollView._dataSource[id]._matrix[13];
which works but I also need to know the flexScrollView absolute offset.
For some reason flexScrollView.getOffset() doesn't show absolute offset of a view. I don't know what it shows.. seems like it resets after whole page was scrolled and strarts over..
How to get absolute offset?
Also I would like to know is there a way to disable scrolling dynamically?
from famous-flex.
Yikes!
If you want to offset a renderable, I suggest you wrap it inside Modifier, and give the Modifier a translation offset:
var RenderNode = require('famous/core/RenderNode');
var Surface = require('famous/core/Surface');
var Modifier = require('famous/core/Modifier');
var Transform = require('famous/core/Transform');
// Create a surface that is offsetted 10px down
var mod = new Modifier({
transform: Transform.translate(0, 10, 0)
});
var sur = new Surface({..});
var node = new RenderNode(mod);
node.add(sur);
// Add surface to scrollview
scrollView.push(node);
To answer your other question. You can use the getSpec
function to get the absolute position of a renderable. This only works though if the renderable is in the DOM.
from famous-flex.
Btw, this method:
var offset_x = flexScrollView._dataSource[id]._matrix[12];
var offset_y = flexScrollView._dataSource[id]._matrix[13];
Don't use it. You are accessing private members of the FlexScrollView and Surface. These will possibly change in a future update causing your code to break.
from famous-flex.
Goedendag,
here is example of what I want to build: https://dl.dropboxusercontent.com/u/49691996/FamousDemo/kit/examples/views/flexScrollCenter/example.html
onclick event should move red surface to the upper left corner independently of the position of the scroll.
I'm use here private members:
var offset_x = flexScrollView._dataSource[3]._matrix[12];
var offset_y = flexScrollView._dataSource[3]._matrix[13];
var absoluteScrollPosition = flexScrollView._scroll.groupStart + flexScrollView.getOffset();
I really don't know how to get these values in a right way.... Can you help me?
- I can't use getSpec because my red surface doesn't have it.
- In documentation is said that flexScrollView.getOffset() is the scroll position of the flexscrollview but I've found out that its not absolute - if you have a lot of elements offset resets continuously while scrolling (after each reset scroll.groupStart collects that value so I've found a way to get absolute position)
- Is it possible to disable scrolling after onclick event?
from famous-flex.
- OK I was stupid to search getSpec in surface. it's a function of a flexScrollView.
- also solves this problem because getSpec() returns absolute values.
- also found options.enabled: bool
from famous-flex.
Related Issues (20)
- velocity limit HOT 10
- Scrollview is only partially shown (after blurring an input element, window scroll position isnt reset) HOT 9
- Pull to refresh on desktop HOT 3
- any plans to support https://github.com/Famous/engine/tree/v1.0.0? HOT 7
- Scrollview: scroll without animation HOT 3
- Invalid bower version HOT 2
- FlexScrollView - mousepad two finger scrolling doesn't work in paginated view
- LayoutController insert 0 not working HOT 6
- CollectionLayout last row just partial visible HOT 1
- WheelLayout (DatePicker) sometimes wrong number sequence HOT 7
- Possible Bug in CollectionLayout HOT 5
- Is mixed-mode really good(right) ? HOT 7
- What is the state of Famous-Flex? HOT 6
- Surface leakage issue because of Entity.register HOT 2
- Bug in DatePicker.Component.FullDay HOT 7
- SamsaraJS support
- Error: HOT 6
- Correction in documentation HOT 2
- Use famous-sizeconstraint with FlexScrollView
- Changes to LinkedListViewSequence does not get reflected in FlexScrollView
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from famous-flex.