Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
baas-ide
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
guxukai
baas-ide
Commits
a76cb8e1
Commit
a76cb8e1
authored
Jan 16, 2019
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
toggle swap panel
parent
f156e6bb
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
9 deletions
+41
-9
app.js
src/app.js
+8
-5
swap-panel-api.js
src/app/components/swap-panel-api.js
+9
-1
panels-resize.js
src/lib/panels-resize.js
+24
-3
No files found.
src/app.js
View file @
a76cb8e1
...
@@ -104,8 +104,9 @@ var css = csjs`
...
@@ -104,8 +104,9 @@ var css = csjs`
flex-direction : column;
flex-direction : column;
position : absolute;
position : absolute;
top : 0;
top : 0;
left : 50px;
bottom : 0;
bottom : 0;
overflow : hidden
overflow : hidden
;
}
}
.highlightcode {
.highlightcode {
position:absolute;
position:absolute;
...
@@ -173,10 +174,7 @@ class App {
...
@@ -173,10 +174,7 @@ class App {
init
()
{
init
()
{
var
self
=
this
var
self
=
this
self
.
_view
.
swappanel
.
style
.
left
=
self
.
_view
.
iconpanel
.
clientWidth
+
'px'
self
.
_components
.
resizeFeature
=
new
PanelsResize
(
'#swap-panel'
,
'#editor-container'
,
{
'minWidth'
:
400
,
x
:
450
})
self
.
_view
.
mainpanel
.
style
.
left
=
(
self
.
_view
.
iconpanel
.
clientWidth
+
self
.
_view
.
swappanel
.
clientWidth
)
+
'px'
let
resizeFeature
=
new
PanelsResize
(
'#swap-panel'
,
'#editor-container'
,
{
'minWidth'
:
400
,
x
:
450
})
// eslint-disable-line
run
.
apply
(
self
)
run
.
apply
(
self
)
}
}
...
@@ -452,6 +450,11 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
...
@@ -452,6 +450,11 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
const
swapPanelApi
=
new
SwapPanelApi
(
swapPanelComponent
,
verticalIconComponent
,
appManager
)
// eslint-disable-line
const
swapPanelApi
=
new
SwapPanelApi
(
swapPanelComponent
,
verticalIconComponent
,
appManager
)
// eslint-disable-line
const
verticalIconsApi
=
new
VerticalIconsApi
(
verticalIconComponent
,
appManager
)
// eslint-disable-line
const
verticalIconsApi
=
new
VerticalIconsApi
(
verticalIconComponent
,
appManager
)
// eslint-disable-line
swapPanelApi
.
event
.
on
(
'toggle'
,
()
=>
{
this
.
_components
.
resizeFeature
.
panel1
.
clientWidth
!==
0
?
this
.
_components
.
resizeFeature
.
minimize
()
:
this
.
_components
.
resizeFeature
.
maximise
()
})
swapPanelApi
.
event
.
on
(
'showing'
,
()
=>
{
this
.
_components
.
resizeFeature
.
maximise
()
})
self
.
_components
.
editorpanel
.
init
()
self
.
_components
.
editorpanel
.
init
()
self
.
_components
.
fileManager
.
init
()
self
.
_components
.
fileManager
.
init
()
...
...
src/app/components/swap-panel-api.js
View file @
a76cb8e1
// const EventEmmitter = require('events')
import
EventEmmitter
from
'events'
class
SwapPanelApi
{
class
SwapPanelApi
{
constructor
(
swapPanelComponent
,
verticalIconsComponent
,
appManager
)
{
constructor
(
swapPanelComponent
,
verticalIconsComponent
,
appManager
)
{
this
.
event
=
new
EventEmmitter
()
this
.
component
=
swapPanelComponent
this
.
component
=
swapPanelComponent
this
.
currentContent
verticalIconsComponent
.
event
.
on
(
'showContent'
,
(
moduleName
)
=>
{
verticalIconsComponent
.
event
.
on
(
'showContent'
,
(
moduleName
)
=>
{
if
(
this
.
currentContent
===
moduleName
)
{
this
.
event
.
emit
(
'toggle'
)
return
}
this
.
event
.
emit
(
'showing'
,
moduleName
)
this
.
component
.
showContent
(
moduleName
)
this
.
component
.
showContent
(
moduleName
)
this
.
currentContent
=
moduleName
})
})
appManager
.
event
.
on
(
'requestContainer'
,
(
mod
,
content
)
=>
{
appManager
.
event
.
on
(
'requestContainer'
,
(
mod
,
content
)
=>
{
this
.
add
(
mod
.
name
,
content
)
this
.
add
(
mod
.
name
,
content
)
...
...
src/lib/panels-resize.js
View file @
a76cb8e1
...
@@ -37,6 +37,9 @@ export default class PanelsResize {
...
@@ -37,6 +37,9 @@ export default class PanelsResize {
constructor
(
idpanel1
,
idpanel2
,
opt
)
{
constructor
(
idpanel1
,
idpanel2
,
opt
)
{
var
panel1
=
document
.
querySelector
(
idpanel1
)
var
panel1
=
document
.
querySelector
(
idpanel1
)
var
panel2
=
document
.
querySelector
(
idpanel2
)
var
panel2
=
document
.
querySelector
(
idpanel2
)
this
.
panel1
=
panel1
this
.
panel2
=
panel2
this
.
opt
=
opt
var
ghostbar
=
yo
`<div class=
${
css
.
ghostbar
}
></div>`
var
ghostbar
=
yo
`<div class=
${
css
.
ghostbar
}
></div>`
...
@@ -61,13 +64,13 @@ export default class PanelsResize {
...
@@ -61,13 +64,13 @@ export default class PanelsResize {
}
}
let
moveGhostbar
=
(
event
)
=>
{
// @NOTE VERTICAL ghostbar
let
moveGhostbar
=
(
event
)
=>
{
// @NOTE VERTICAL ghostbar
let
p
=
processPositi
i
ons
(
event
)
let
p
=
processPositions
(
event
)
if
(
p
.
panel1Width
<=
opt
.
minWidth
||
p
.
panel2Width
<=
opt
.
minWidth
)
return
if
(
p
.
panel1Width
<=
opt
.
minWidth
||
p
.
panel2Width
<=
opt
.
minWidth
)
return
ghostbar
.
style
.
left
=
event
.
x
+
'px'
ghostbar
.
style
.
left
=
event
.
x
+
'px'
}
}
let
setPosition
=
(
event
)
=>
{
let
setPosition
=
(
event
)
=>
{
let
p
=
processPositi
i
ons
(
event
)
let
p
=
processPositions
(
event
)
panel1
.
style
.
width
=
p
.
panel1Width
+
'px'
panel1
.
style
.
width
=
p
.
panel1Width
+
'px'
panel2
.
style
.
left
=
p
.
panel2left
+
'px'
panel2
.
style
.
left
=
p
.
panel2left
+
'px'
panel2
.
style
.
width
=
p
.
panel2Width
+
'px'
panel2
.
style
.
width
=
p
.
panel2Width
+
'px'
...
@@ -81,7 +84,7 @@ export default class PanelsResize {
...
@@ -81,7 +84,7 @@ export default class PanelsResize {
setPosition
(
event
)
setPosition
(
event
)
}
}
let
processPositi
i
ons
=
(
event
)
=>
{
let
processPositions
=
(
event
)
=>
{
let
panel1Width
=
event
.
x
-
panel1
.
offsetLeft
let
panel1Width
=
event
.
x
-
panel1
.
offsetLeft
panel1Width
=
panel1Width
<
opt
.
minWidth
?
opt
.
minWidth
:
panel1Width
panel1Width
=
panel1Width
<
opt
.
minWidth
?
opt
.
minWidth
:
panel1Width
let
panel2left
=
panel1
.
offsetLeft
+
panel1Width
let
panel2left
=
panel1
.
offsetLeft
+
panel1Width
...
@@ -99,4 +102,22 @@ export default class PanelsResize {
...
@@ -99,4 +102,22 @@ export default class PanelsResize {
setPosition
(
opt
)
setPosition
(
opt
)
}
}
minimize
()
{
let
panel1Width
=
0
let
panel2left
=
this
.
panel1
.
offsetLeft
+
panel1Width
let
panel2Width
=
this
.
panel2
.
parentElement
.
clientWidth
-
this
.
panel1
.
offsetLeft
-
panel1Width
this
.
panel1
.
style
.
width
=
panel1Width
+
'px'
this
.
panel2
.
style
.
left
=
panel2left
+
'px'
this
.
panel2
.
style
.
width
=
panel2Width
+
'px'
}
maximise
()
{
let
panel1Width
=
this
.
opt
.
minWidth
let
panel2left
=
this
.
panel1
.
offsetLeft
+
panel1Width
let
panel2Width
=
this
.
panel2
.
parentElement
.
clientWidth
-
this
.
panel1
.
offsetLeft
-
panel1Width
this
.
panel1
.
style
.
width
=
panel1Width
+
'px'
this
.
panel2
.
style
.
left
=
panel2left
+
'px'
this
.
panel2
.
style
.
width
=
panel2Width
+
'px'
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment