mirror of
https://github.com/streamwall/streamwall.git
synced 2026-01-24 22:22:50 -05:00
Skip unnecessary view re-positions
This commit is contained in:
@@ -86,15 +86,19 @@ const viewStateMachine = Machine(
|
||||
type: 'parallel',
|
||||
entry: 'positionView',
|
||||
on: {
|
||||
DISPLAY: {
|
||||
actions: [
|
||||
assign({
|
||||
pos: (context, event) => event.pos,
|
||||
}),
|
||||
'positionView',
|
||||
],
|
||||
cond: 'contentUnchanged',
|
||||
},
|
||||
DISPLAY: [
|
||||
// Noop if nothing changed.
|
||||
{ cond: 'contentPosUnchanged' },
|
||||
{
|
||||
actions: [
|
||||
assign({
|
||||
pos: (context, event) => event.pos,
|
||||
}),
|
||||
'positionView',
|
||||
],
|
||||
cond: 'contentUnchanged',
|
||||
},
|
||||
],
|
||||
},
|
||||
states: {
|
||||
audio: {
|
||||
@@ -167,6 +171,12 @@ const viewStateMachine = Machine(
|
||||
contentUnchanged: (context, event) => {
|
||||
return isEqual(context.content, event.content)
|
||||
},
|
||||
contentPosUnchanged: (context, event) => {
|
||||
return (
|
||||
isEqual(context.content, event.content) &&
|
||||
isEqual(context.pos, event.pos)
|
||||
)
|
||||
},
|
||||
optionsChanged: (context, event) => {
|
||||
return !isEqual(context.options, event.options)
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user