Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
siibra-explorer
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Xiao Gui
siibra-explorer
Commits
fa6ee2be
Unverified
Commit
fa6ee2be
authored
5 years ago
by
xgui3783
Committed by
GitHub
5 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #308 from HumanBrainProject/bugfix/fixPanelShuffling
bugfix: fix shuffling of panels
parents
9ab1b1cd
0b761f1a
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/services/state/ngViewerState.store.ts
+62
-16
62 additions, 16 deletions
src/services/state/ngViewerState.store.ts
with
62 additions
and
16 deletions
src/services/state/ngViewerState.store.ts
+
62
−
16
View file @
fa6ee2be
...
@@ -17,6 +17,9 @@ export interface NgViewerStateInterface{
...
@@ -17,6 +17,9 @@ export interface NgViewerStateInterface{
nehubaReady
:
boolean
nehubaReady
:
boolean
panelMode
:
string
panelMode
:
string
panelOrder
:
string
panelOrder
:
string
showSubstrate
:
boolean
showZoomlevel
:
boolean
}
}
export
interface
NgViewerAction
extends
Action
{
export
interface
NgViewerAction
extends
Action
{
...
@@ -31,7 +34,10 @@ const defaultState:NgViewerStateInterface = {
...
@@ -31,7 +34,10 @@ const defaultState:NgViewerStateInterface = {
forceShowSegment
:
null
,
forceShowSegment
:
null
,
nehubaReady
:
false
,
nehubaReady
:
false
,
panelMode
:
FOUR_PANEL
,
panelMode
:
FOUR_PANEL
,
panelOrder
:
`0123`
panelOrder
:
`0123`
,
showSubstrate
:
null
,
showZoomlevel
:
null
}
}
export
function
ngViewerState
(
prevState
:
NgViewerStateInterface
=
defaultState
,
action
:
NgViewerAction
):
NgViewerStateInterface
{
export
function
ngViewerState
(
prevState
:
NgViewerStateInterface
=
defaultState
,
action
:
NgViewerAction
):
NgViewerStateInterface
{
...
@@ -39,6 +45,7 @@ export function ngViewerState(prevState:NgViewerStateInterface = defaultState, a
...
@@ -39,6 +45,7 @@ export function ngViewerState(prevState:NgViewerStateInterface = defaultState, a
case
ACTION_TYPES
.
SET_PANEL_ORDER
:
{
case
ACTION_TYPES
.
SET_PANEL_ORDER
:
{
const
{
payload
}
=
action
const
{
payload
}
=
action
const
{
panelOrder
}
=
payload
const
{
panelOrder
}
=
payload
return
{
return
{
...
prevState
,
...
prevState
,
panelOrder
panelOrder
...
@@ -119,7 +126,10 @@ export class NgViewerUseEffect implements OnDestroy{
...
@@ -119,7 +126,10 @@ export class NgViewerUseEffect implements OnDestroy{
public
toggleMaximiseMode$
:
Observable
<
any
>
public
toggleMaximiseMode$
:
Observable
<
any
>
@
Effect
()
@
Effect
()
public
toggleMaximiseOrder$
:
Observable
<
any
>
public
unmaximiseOrder$
:
Observable
<
any
>
@
Effect
()
public
maximiseOrder$
:
Observable
<
any
>
@
Effect
()
@
Effect
()
public
toggleMaximiseCycleMessage$
:
Observable
<
any
>
public
toggleMaximiseCycleMessage$
:
Observable
<
any
>
...
@@ -170,22 +180,61 @@ export class NgViewerUseEffect implements OnDestroy{
...
@@ -170,22 +180,61 @@ export class NgViewerUseEffect implements OnDestroy{
})
})
)
)
this
.
toggleM
aximiseOrder$
=
toggleMaxmimise$
.
pipe
(
this
.
m
aximiseOrder$
=
toggleMaxmimise$
.
pipe
(
withLatestFrom
(
withLatestFrom
(
combineLatest
(
combineLatest
(
this
.
panelOrder$
.
pipe
(
this
.
panelOrder$
,
scan
((
acc
,
curr
:
string
)
=>
[
curr
,
...
acc
.
slice
(
0
,
1
)],
[]),
),
this
.
panelMode$
this
.
panelMode$
)
)
),
),
map
(([
action
,
[
panelOrders
,
panelMode
]])
=>
{
filter
(([
_action
,
[
_panelOrder
,
panelMode
]])
=>
panelMode
!==
SINGLE_PANEL
),
map
(([
action
,
[
oldPanelOrder
]
])
=>
{
const
{
payload
}
=
action
as
NgViewerAction
const
{
payload
}
=
action
as
NgViewerAction
const
{
index
=
0
}
=
payload
const
{
index
=
0
}
=
payload
const
panelOrder
=
panelMode
===
SINGLE_PANEL
&&
!!
panelOrders
[
1
]
const
panelOrder
=
[...
oldPanelOrder
.
slice
(
index
),
...
oldPanelOrder
.
slice
(
0
,
index
)].
join
(
''
)
?
panelOrders
[
1
]
return
{
:
[...
panelOrders
[
0
].
slice
(
index
),
...
panelOrders
[
0
].
slice
(
0
,
index
)].
join
(
''
)
type
:
ACTION_TYPES
.
SET_PANEL_ORDER
,
payload
:
{
panelOrder
}
}
})
)
this
.
unmaximiseOrder$
=
toggleMaxmimise$
.
pipe
(
withLatestFrom
(
combineLatest
(
this
.
panelOrder$
,
this
.
panelMode$
)
),
scan
((
acc
,
curr
)
=>
{
const
[
action
,
[
panelOrders
,
panelMode
]]
=
curr
return
[{
action
,
panelOrders
,
panelMode
},
...
acc
.
slice
(
0
,
1
)]
},
[]
as
any
[]),
filter
(([
{
panelMode
}
])
=>
panelMode
===
SINGLE_PANEL
),
map
(
arr
=>
{
const
{
action
,
panelOrders
}
=
arr
[
0
]
const
{
panelOrders
:
panelOrdersPrev
=
null
,
}
=
arr
[
1
]
||
{}
const
{
payload
}
=
action
as
NgViewerAction
const
{
index
=
0
}
=
payload
const
panelOrder
=
!!
panelOrdersPrev
?
panelOrdersPrev
:
[...
panelOrders
.
slice
(
index
),
...
panelOrders
.
slice
(
0
,
index
)].
join
(
''
)
return
{
return
{
type
:
ACTION_TYPES
.
SET_PANEL_ORDER
,
type
:
ACTION_TYPES
.
SET_PANEL_ORDER
,
payload
:
{
payload
:
{
...
@@ -220,12 +269,9 @@ export class NgViewerUseEffect implements OnDestroy{
...
@@ -220,12 +269,9 @@ export class NgViewerUseEffect implements OnDestroy{
})
})
)
)
this
.
spacebarListener$
=
combineLatest
(
this
.
spacebarListener$
=
fromEvent
(
document
.
body
,
'
keydown
'
,
{
capture
:
true
}).
pipe
(
fromEvent
(
document
.
body
,
'
keydown
'
,
{
capture
:
true
}).
pipe
(
filter
((
ev
:
KeyboardEvent
)
=>
ev
.
key
===
'
'
),
filter
((
ev
:
KeyboardEvent
)
=>
ev
.
key
===
'
'
)
withLatestFrom
(
this
.
panelMode$
),
),
this
.
panelMode$
).
pipe
(
filter
(([
_
,
panelMode
])
=>
panelMode
===
SINGLE_PANEL
),
filter
(([
_
,
panelMode
])
=>
panelMode
===
SINGLE_PANEL
),
mapTo
({
mapTo
({
type
:
ACTION_TYPES
.
CYCLE_VIEWS
type
:
ACTION_TYPES
.
CYCLE_VIEWS
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment