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

refactor(flat-components): change model #1849

Merged
merged 1 commit into from
Mar 5, 2023

Conversation

hyrious
Copy link
Member

@hyrious hyrious commented Mar 2, 2023

  • adjust scroll button styles
  • adjust absent avatar styles

Synced storage model changed, based on #1847: @netless-io/native

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

When grid is null, it is in normal mode.

When grid is array, it is in maximized mode, the order in this array is the index field in previous design.

This way, you can remember the last state of avatars (is it maximized from windowed mode or from the stage?).

// double click the on-stage user to pull it into maximized mode
const createMaximizedWindow = (userUUID) => {
  let grid = userWindows$$.state.grid || getWindowdUsers()
  userWindows$$.setState({ grid: [...grid, userUUID] })
}

// double click the windowed user to jump in maximized mode
const setMaximized = () => {
  userWindows$$.setState({ grid: getWindowdUsers() })
}

// double click the maximized user to restore states
const restore = () => {
  userWindows$$.setState({ grid: null })
}

As you can see in the example codes, we only change one field of the storage. In fact, the whole data structure leaves no invalid state.

- adjust scroll button styles
- adjust absent avatar styles
@syt-honey syt-honey merged commit b055247 into netless-io:main Mar 5, 2023
@hyrious hyrious deleted the floating-avatar branch March 6, 2023 02:15
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

2 participants