-
Notifications
You must be signed in to change notification settings - Fork 59
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
Implementation to allow right panel's resizing and to go into full-screen mode #24
Merged
Merged
Changes from 4 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
c07e280
Adds the RightPanel view to be the parent of Outline and Inspector.
thachmai 0e97cdf
Adds the click handler to RightResize to change the width of RightPan…
thachmai 197f7a8
Changes the click-to-collapse behavior of the right panel resize bar …
thachmai dfaae93
Adds the full-screen / edit mode switch.
thachmai a470410
Adds icons to full-screen / edit button.
thachmai 7c1484f
Refactors RightPanel.coffee to get rid of the ref.
thachmai fb943ea
Merge branch 'master' of github.com:cdglabs/apparatus into layout-ref…
thachmai b3fa4cd
Refactors layout css to use flex display.
thachmai 0602d74
Refactors full-screen implementation to prevent rendering of the UI c…
thachmai e648162
Fixes canvas size in css.
thachmai 0f8a96a
Fixes style for generic canvas.
thachmai 8ea6c22
Fixes createPanel's x icon placement and right panel resize calculation.
thachmai f5617a9
Adds fullscreen and edit to fontcustom.
thachmai File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
|
||
module.exports = class Layout | ||
constructor: -> | ||
@rightPanelWidth = 400 | ||
@_rightPanelMin = 100 | ||
@_rightPanelMax = 600 | ||
@fullScreen = false | ||
|
||
resizeRightPanel: (xDelta) -> | ||
@rightPanelWidth -= xDelta | ||
@rightPanelWidth = Math.min(@_rightPanelMax, Math.max(@_rightPanelMin, @rightPanelWidth)) | ||
@_refreshLayout() | ||
|
||
toggleFullScreen: -> | ||
@fullScreen = !@fullScreen | ||
@_refreshLayout() | ||
|
||
_refreshLayout: -> | ||
# Changing the layout will deform the canvas | ||
# This is a workaround by triggering "resize" event so that the Canvas will update itself | ||
resize = new Event "resize" | ||
window.dispatchEvent resize | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
R = require "./R" | ||
Model = require "../Model/Model" | ||
Util = require "../Util/Util" | ||
|
||
|
||
R.create "RightPanel", | ||
contextTypes: | ||
editor: Model.Editor | ||
dragManager: R.DragManager | ||
|
||
_onResizeMouseDown: (mouseDownEvent) -> | ||
startX = mouseDownEvent.clientX | ||
layout = @context.editor.layout | ||
|
||
@context.dragManager.start mouseDownEvent, | ||
cursor: "ew-resize" | ||
onMove: (moveEvent) => | ||
dx = moveEvent.clientX - startX | ||
startX = moveEvent.clientX | ||
layout.resizeRightPanel(dx) | ||
|
||
componentDidMount: -> | ||
@refs.resize.getDOMNode().addEventListener("mousedown", @_onResizeMouseDown) | ||
|
||
render: -> | ||
layout = @context.editor.layout | ||
|
||
R.div { | ||
className: R.cx { | ||
RightPanel: true | ||
FullScreen: layout.fullScreen | ||
} | ||
style: { | ||
width: layout.rightPanelWidth | ||
} | ||
}, | ||
R.div { | ||
className: "RightResize" | ||
ref: "resize" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead of giving this a ref in order to make it respond to mousedown (in line 22-23), you can just give this a
This will call @_onResizeMouseDown with the expected |
||
#onClick: layout.dragRightPanel.bind(layout, 10) | ||
} | ||
R.Outline {} | ||
R.Inspector {} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't need this ref