Skip to content

Commit

Permalink
Remove isDragging from application controller
Browse files Browse the repository at this point in the history
isDragging was used to keep the col-resize cursor active
  • Loading branch information
nummi committed Oct 1, 2019
1 parent eb52384 commit 504e2fd
Show file tree
Hide file tree
Showing 19 changed files with 33 additions and 49 deletions.
6 changes: 0 additions & 6 deletions app/controllers/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,4 @@ export default Controller.extend({
}

},

actions: {
setIsDragging(isDragging) {
this.set('isDragging', isDragging);
},
}
});
4 changes: 1 addition & 3 deletions app/controllers/container-types.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import Controller, { inject as controller } from '@ember/controller';
import Controller from '@ember/controller';
import { sort } from '@ember/object/computed';

export default Controller.extend({
application: controller(),

sorted: sort('model', 'sortProperties'),

init() {
Expand Down
3 changes: 1 addition & 2 deletions app/controllers/info.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import Controller, { inject as controller } from '@ember/controller';
import Controller from '@ember/controller';

export default Controller.extend({
application: controller(),
navWidth: 180,
});
3 changes: 1 addition & 2 deletions app/controllers/model-types.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Controller, { inject as controller } from '@ember/controller';
import Controller from '@ember/controller';
import { get, computed } from '@ember/object';
import LocalStorageService from 'ember-inspector/services/storage/local';
import { sort } from '@ember/object/computed';
Expand All @@ -9,7 +9,6 @@ import {
} from 'ember-inspector/utils/local-storage-keys';

export default Controller.extend({
application: controller(),
navWidth: 180,
storage: service(`storage/${LocalStorageService.STORAGE_TYPE_TO_USE}`),

Expand Down
4 changes: 1 addition & 3 deletions app/controllers/promise-tree.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import { action, observer } from '@ember/object';
import Controller, { inject as controller } from '@ember/controller';
import Controller from '@ember/controller';
import { isEmpty } from '@ember/utils';
import { equal, bool, and, not, filter } from '@ember/object/computed';
import { debounce, next, once } from '@ember/runloop';

export default Controller.extend({
application: controller(),

queryParams: ['filter'],

createdAfter: null,
Expand Down
3 changes: 1 addition & 2 deletions app/controllers/render-tree.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import { action, computed, get } from '@ember/object';
import { isEmpty } from '@ember/utils';
import Controller, { inject as controller } from '@ember/controller';
import Controller from '@ember/controller';
import { inject as service } from '@ember/service';
import escapeRegExp from "ember-inspector/utils/escape-reg-exp";
import debounceComputed from "ember-inspector/computed/debounce";
import LocalStorageService from "ember-inspector/services/storage/local";
import { and, equal } from '@ember/object/computed';

export default Controller.extend({
application: controller(),
initialEmpty: false,
modelEmpty: equal('model.length', 0),
showEmpty: and('initialEmpty', 'modelEmpty'),
Expand Down
4 changes: 0 additions & 4 deletions app/styles/app.scss
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@
z-index: 0;
}

.app.is-dragging {
cursor: col-resize;
}

@import "base";
@import "colors";
@import "utils";
Expand Down
7 changes: 1 addition & 6 deletions app/templates/application.hbs
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
<div
class="ember-view app {{if this.active "" "inactive"}} {{if this.isDragging "isDragging"}}"
class="ember-view app {{if this.active "" "inactive"}}"
tabindex="1"
{{on "focusin" (fn this.setActive true)}}
{{on "focusout" (fn this.setActive false)}}
>
{{#if this.isEmberApplication}}
<div class="split">
<div class="split__panel">
{{!-- Begin main --}}
<div class="split split--main">
<Ui::DraggableColumn
@classes="split__panel split__panel--sidebar-1"
@setIsDragging={{action "setIsDragging"}}
@side="left"
@width={{this.navWidth}}
>
Expand Down Expand Up @@ -44,14 +42,11 @@
</MainContent>
</div>
</div>

{{!-- End main --}}
</div>

{{#if this.inspectorExpanded}}
<Ui::DraggableColumn
@classes="split__panel"
@setIsDragging={{action "setIsDragging"}}
@side="right"
@width={{this.inspectorWidth}}
>
Expand Down
1 change: 0 additions & 1 deletion app/templates/components/item-types.hbs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<div class="split">
<Ui::DraggableColumn
@classes="split__panel split__panel--sidebar-2 nav"
@setIsDragging={{@setIsDragging}}
@side="left"
@width={{@width}}
>
Expand Down
1 change: 0 additions & 1 deletion app/templates/components/list.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
@maxWidth={{column.maxWidth}}
@on-drag={{action "didResize" column.id}}
@position={{one-way column.width}}
@setIsDragging={{@setIsDragging}}
@side="left"
/>
{{/if}}
Expand Down
1 change: 0 additions & 1 deletion app/templates/container-types.hbs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<ItemTypes
@header="Types"
@setIsDragging={{action "setIsDragging" target=application}}
@sorted={{readonly sorted}}
@type="container"
@width={{180}}
Expand Down
1 change: 0 additions & 1 deletion app/templates/info.hbs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<div class="split">
<Ui::DraggableColumn
@classes="split__panel split__panel--sidebar-2 nav"
@setIsDragging={{action "setIsDragging" target=this.application}}
@side="left"
@width={{this.navWidth}}
>
Expand Down
1 change: 0 additions & 1 deletion app/templates/model-types.hbs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<ItemTypes
@header="Model Types"
@setIsDragging={{action "setIsDragging" target=application}}
@sorted={{readonly (if this.orderByRecordCount this.sortByDescCount this.sortByName)}}
@type="model"
@width={{this.navWidth}}
Expand Down
3 changes: 1 addition & 2 deletions app/templates/promise-tree.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
{{else}}
<List
class="js-promise-tree"
@schema={{schema-for "promise-tree"}}
@setIsDragging={{action "setIsDragging" target=this.application}} as |list|
@schema={{schema-for "promise-tree"}} as |list|
>
{{#list.vertical-collection this.filtered as |content index|}}
<tr class="list__row js-promise-tree-item {{if (mod index 2) "striped"}}">
Expand Down
3 changes: 1 addition & 2 deletions app/templates/render-tree.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
<List
class="js-render-tree list--css-striping"
@headerHeight={{this.headerHeight}}
@schema={{schema-for "render-tree"}}
@setIsDragging={{action "setIsDragging" target=this.application}} as |list|
@schema={{schema-for "render-tree"}} as |list|
>
<tbody>
{{#each this.filtered as |item|}}
Expand Down
3 changes: 0 additions & 3 deletions lib/ui/addon/components/drag-handle.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@ export default Component.extend({
'on-drag'() {},

startDragging() {
this.setIsDragging(true);

this._mouseMoveHandler = this.mouseMoveHandler.bind(this);
this._stopDragging = this.stopDragging.bind(this);
document.body.addEventListener(`mousemove`, this._mouseMoveHandler);
Expand All @@ -69,7 +67,6 @@ export default Component.extend({
},

stopDragging() {
this.setIsDragging(false);
document.body.removeEventListener(`mousemove`, this._mouseMoveHandler);
document.body.removeEventListener(`mouseup`, this._stopDragging);
document.body.removeEventListener(`mouseleave`, this._stopDragging);
Expand Down
29 changes: 25 additions & 4 deletions lib/ui/addon/styles/_drag-handle.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,52 @@
The drag handle used for resizing elements
*/

:root {
--drag-handle-width: 6px;
--drag-handle-active-width: 60px;
}

.drag-handle {
bottom: 0;
cursor: col-resize;
position: absolute;
top: 0;
width: 6px;
width: var(--drag-handle-width);
z-index: 500;
}

.drag-handle--right {
margin-right: -3px;
margin-right: calc(var(--drag-handle-width) / 2 * -1);
}

.drag-handle--left {
margin-left: -3px;
margin-left: calc(var(--drag-handle-width) / 2 * -1);
}

.drag-handle__border {
border-left: 1px solid var(--base06);
height: 100%;
margin-left: 3px;
margin-left: calc(var(--drag-handle-width) / 2);
pointer-events: none;
width: 1px;
}

.drag-handle:active {
width: var(--drag-handle-active-width);

&.drag-handle--right {
margin-right: calc(var(--drag-handle-active-width) / 2 * -1);
}

&.drag-handle--left {
margin-left: calc(var(--drag-handle-active-width) / 2 * -1);
}

.drag-handle__border {
margin-left: calc(var(--drag-handle-active-width) / 2);
}
}

.drag-handle--faded {
opacity: 0.3;
}
4 changes: 0 additions & 4 deletions lib/ui/addon/styles/_nav.scss
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@
&:focus { outline: none; }
}

.app.is-dragging .nav__item {
cursor: col-resize;
}

.nav__item.active {
background: var(--focus);
color: var(--focus-text);
Expand Down
1 change: 0 additions & 1 deletion lib/ui/addon/templates/components/draggable-column.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,5 @@
@minWidth={{this.minWidth}}
@on-drag={{this.triggerResize}}
@position={{@width}}
@setIsDragging={{@setIsDragging}}
@side={{@side}}
/>

0 comments on commit 504e2fd

Please sign in to comment.