Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(flat-components): add avatar window #1847

Merged
merged 2 commits into from
Mar 1, 2023

Conversation

hyrious
Copy link
Member

@hyrious hyrious commented Mar 1, 2023

Notes about the implementation @netless-io/native

New synced storage userWindows:

connectStorage("userWindows", {
  mode: 'normal',         // normal | maximized
  [userUUID]: {
    x, y, width, height,
    z,                    // window z-index in normal mode
    index,                // order in maximized mode
  }
})

Where x, y, width, height are all in the range of 0 to 1.

Windows have constant aspect ratio = $\frac{3}{4}$ (the same as video avatar).

The default window size is (0.4, 8/15):

$$\begin{align*} \texttt{width} &= 0.4 \\\ \texttt{height} &= \texttt{width} \cdot \frac{\frac{3}{4}}{\frac{9}{16}} \\\ &= \frac{8}{15} \end{align*}$$

The minimal window size is width = $0.25$.

When create a new window, set its index = maxIndex + 1, z = maxZ + 1.

When click or move a window, set its z = maxZ_except_itself + 1.

When use double click to create a window, set its x = y = 0.1, width = 0.4, height = 8/15.

@Leooeloel Leooeloel merged commit 54fbc8f into netless-io:main Mar 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants