Commit Graph

29 Commits

Author SHA1 Message Date
Matthew Dapena-Tretter
6f194c7811 Make sure there's a single source of truth for dock hover state
Previously, the workspace's idea of the hovered dock and the docks'
themselves could be out of sync.
2018-03-01 14:56:52 -08:00
Matthew Dapena-Tretter
c69c82d05a Fix dock dragging and dropping
This fixes #16769, which described an issue whereby trying to drop into
a closed dock would cause the dock to repeatedly open and close.

I tried to describe in comments why this was happening and how we can
make sure to avoid it.

The solution adds another DOM measurement which I'm not too thrilled
about but I profiled and it didn't seem to be an issue.
2018-02-28 18:14:13 -08:00
Will Binns-Smith
b42972fa84 Add custom properties to atom-workspace to track editor properties (#16731)
* Add custom properties to atom-workspace

These track the editor's current font size, font family, and line
height.

* Move editor styles to text-editor; add monospace fallback

* Add default font family

So that there will always be a valid value.

* Fix specs
2018-02-21 19:02:14 -08:00
Antonio Scandurra
8077f46fdf Programmatically detect when mouse approaches the edge of a dock
Previously, we would assign dock elements a minimum width/height of 2
pixels so that we could detect when the mouse approached the edge of a
hidden dock in order to show the chevron buttons. This, however, was
causing confusion for users, who expected that extra space to be
clickable in order to scroll editors located in the center dock.

With this commit we will instead register a global `mousemove` event on
the window right when attaching the workspace element to the DOM (the
event handler is debounced, so this shouldn't have any performance
consequence). Then, when mouse moves, we will programmatically detect
when it is approaching to the edge of a dock and show the chevron button
accordingly. This allows us to remove the `min-width` property from the
dock container element, which eliminates the confusing behavior
described above.
2018-01-12 17:12:55 +01:00
Antonio Scandurra
a7e642e473 Destroy underlying element when resetting or destroying Workspace 2018-01-12 16:06:35 +01:00
Josh Soref
2947d6b81d spelling: workspace 2017-09-10 15:46:41 +00:00
Will Binns-Smith
882a1924f0 Remove one-off eslint global pragmas in favor of envs 2017-08-20 19:55:00 -07:00
Jason Rudolph
8cae9a1365 🎨 Refactor: Extract getVisiblePanes() function 2017-05-31 12:01:10 -04:00
Jason Rudolph
0e3dfc3ba1 🎨 Refactor: Extract getVisiblePaneContainers() function 2017-05-31 11:57:57 -04:00
Jason Rudolph
fc007edddd 🎨 Refactor initialization of visiblePaneContainers
xref: https://github.com/atom/atom/pull/14640#discussion_r119169281
2017-05-31 11:53:05 -04:00
Jason Rudolph
4c9acf00b3 🎨 Nobody's getting paid by lines of code
xref: https://github.com/atom/atom/pull/14640#pullrequestreview-41023656
2017-05-31 11:51:17 -04:00
Jason Rudolph
81b05023db Refactor: Move directional pane fns to WorkspaceElement 2017-05-25 08:51:22 -04:00
Jason Rudolph
1dfdd84393 Add ability to move directionally across *all* visible panes
Prior to this change, the following commands successfully move between
panes in the workspace center, but they could not move between the the
panes in the workspace center and panes in the docks:

- window:focus-pane-above
- window:focus-pane-below
- window:focus-pane-on-left
- window:focus-pane-on-right
- window:move-active-item-to-pane-above
- window:move-active-item-to-pane-below
- window:move-active-item-to-pane-on-left
- window:move-active-item-to-pane-on-right
- window:copy-active-item-to-pane-above
- window:copy-active-item-to-pane-below
- window:copy-active-item-to-pane-on-left
- window:copy-active-item-to-pane-on-right

This commit updates these commands to work across all visible panes,
regardless of whether the pane is in the workspace center or a dock.

Summary of approach:

- Add tests for the `nearestVisiblePaneInDirection`, which provides the
  core logic for the higher-level methods like `focusPaneViewAbove`,
  `moveActiveItemToPaneAbove`, `focusPaneViewOnLeft`, etc.
    - Test the generic logic extensively (i.e., the logic that is
      independent of whether the given pane resides in the workspace
      center or a dock)
    - Also test the navigation between docks and the workspace center
- Since the core logic is tested in the new tests above, simplify the
  tests for the higher-level methods (e.g., `focusPaneViewAbove`,
  `moveActiveItemToPaneAbove`, `focusPaneViewOnLeft`) to avoid
  unnecessary duplication.
- Add `nearestVisiblePaneInDirection` to `WorkspaceElement`, implemented
  in terms of the existing `nearestPaneInDirection` method on
  `PaneContainerElement` for now.
2017-05-24 17:30:15 -04:00
Antonio Scandurra
d158e44374 Merge branch 'master' into tj-upgrade-electron 2017-05-19 11:05:15 +02:00
Max Brunsfeld
e99545ee41 Fix exception when starting to drag text 2017-05-18 10:13:48 -07:00
Nathan Sobo
8bb3ec1563 Synchronously sample font styling when global editor stylesheet changes
And don’t sample font styling in pollDOM, which we are aiming to
eliminate.

Signed-off-by: Max Brunsfeld <maxbrunsfeld@github.com>
2017-05-03 14:21:24 +02:00
Matthew Dapena-Tretter
915931dddd 🐛 Make sure docks affordance can always be revealed 2017-04-13 15:52:05 -07:00
Matthew Dapena-Tretter
8951ee7dd1 Remove event listeners from correct element 2017-04-11 22:14:18 -07:00
Max Brunsfeld
c43bfafdfb Move hoveredDock property from Workspace to WorkspaceElement
It's not used in Workspace anymore.
2017-04-10 14:18:58 -07:00
Max Brunsfeld
399b70662d Fix regression in hovered dock tracking due to workspace refactor
Also, backfill tests for showing, hiding and updating the dock toggle
buttons in response to mouse movements.
2017-04-10 14:15:31 -07:00
Max Brunsfeld
233c29d998 Fix usages of Workspace.paneContainer 2017-04-06 16:37:37 -07:00
Max Brunsfeld
6d55371930 Add Workspace.getElement method, remove WorkspaceElement view provider 2017-04-05 15:32:00 -07:00
Matthew Dapena-Tretter
41953ae7d6 Only show dock toggle buttons when dragging if item is allowed 2017-03-27 17:45:15 -07:00
Matthew Dapena-Tretter
d9e1fcc70b Merge branch 'master' into HEAD
* master: (43 commits)
  If one arch fails, kill the other for perf on appveyor
  ⬆️ dalek@0.2.1
  Revert "⬆️ all packages that use atom-select-list"
  ⬆️ atom-keymap
  ⬆️ status-bar
  ⬆️ all packages that use atom-select-list
  ⬆️ language-ruby@0.71.0
  ⬆️ autocomplete-css@0.16.1
  Ensure `packagesCache` exists before accessing it
  🎨
  ⬆️ less-cache
  Use `core/` instead of `<embedded>` for keymaps loaded during snapshot
  Set also defaultSettings.core.projectHome when initializing Config
  Fix tests
  ⬆️ atom-keymap
  Replace CommandRegistry.addBundled with a boolean param in .add
  Delete unused build scripts
  🔥 Remove parserlib
  Resolve style sheets paths during `script/build` for bundled packages
  Don't use cached less sources and imported files in dev mode
  ...
2017-03-23 18:47:46 -07:00
Matthew Dapena-Tretter
bf39947eee Add Dock component 2017-03-18 15:31:51 -07:00
Antonio Scandurra
70177e5a4d Merge branch 'as-snapshot-atom-environment' into as-ns-optimize-stylesheets-loading
# Conflicts:
#	script/package.json
#	script/tdd
#	src/atom-environment.coffee
#	src/context-menu-manager.coffee
#	src/keymap-extensions.coffee
#	src/theme-manager.coffee
#	src/workspace-element.coffee
2017-03-13 08:32:12 +01:00
Matthew Dapena-Tretter
3017b28ef7 Convert workspace element to JS: Cleanup 2017-03-07 16:31:00 -08:00
Matthew Dapena-Tretter
ca4d55954b Convert workspace element to JS: Lint 2017-03-07 15:56:57 -08:00
Matthew Dapena-Tretter
ede4a2972a Convert workspace element to JS: Decaffeinate 2017-03-07 15:49:22 -08:00