alibaba-fusion / overlay Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
解决:期望点击不同按钮,所有的弹窗都在一个地方展示
调整目的:overlay需要展示在其参考视口内,不能被遮挡,通过调整placement来达到目的,若所有placement都无法满足,则取唯一没有被遮挡的方向
思路: 根据遮挡情况,在placement全集里进行排除,获取到所有可能可用的位置,然后根据用户设置的原始placement进行优先级排序,最后依次尝试,直到找到一个可用的placement结束
placement全集为: t tl tr r rt rb b bl br l lt lb
placement可以拆分为 direction + align
规则:根据用户设定的placement,调整后更符合预期的优先级更高。
更符合预期规则:
例子:
1.用户设定 placement为 t,则优先级从大到小为:
2.用户设定placement为 tl,则优先级从大到小为:
相对于参考视口viewport
overlayLeft >= 0 && overlayTop >=0 && overlayLeft + overlayWidth < viewportWidth && overlayTop + overlayHeight <= viewportHeight
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.