Skip to content
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

Rewrite VerticalCollection to a GlimmerComponent #403

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions addon/-private/data-view/elements/occluded-content.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { set } from '@ember/object';
import { DEBUG } from '@glimmer/env';
import { tracked } from '@glimmer/tracking';

import document from '../../utils/document-shim';

let OC_IDENTITY = 0;

export default class OccludedContent {
@tracked element;

constructor(tagName) {
this.id = `OC-${OC_IDENTITY++}`;
this.isOccludedContent = true;
Expand Down Expand Up @@ -72,6 +74,6 @@ export default class OccludedContent {
}

destroy() {
set(this, 'element', null);
this.element = null;
}
}
8 changes: 6 additions & 2 deletions addon/-private/data-view/elements/virtual-component.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { set } from '@ember/object';
import { tracked } from '@glimmer/tracking';
import { assert } from '@ember/debug';
import { DEBUG } from '@glimmer/env';

Expand All @@ -7,6 +8,9 @@ import document from '../../utils/document-shim';
let VC_IDENTITY = 0;

export default class VirtualComponent {
@tracked upperBound;
@tracked lowerBound;

constructor(content = null, index = null) {
this.id = `VC-${VC_IDENTITY++}`;

Expand Down Expand Up @@ -79,8 +83,8 @@ export default class VirtualComponent {
}

destroy() {
set(this, 'upperBound', null);
set(this, 'lowerBound', null);
this.upperBound = null;
this.lowerBound = null;
set(this, 'content', null);
set(this, 'index', null);
}
Expand Down
16 changes: 9 additions & 7 deletions addon/-private/data-view/radar/dynamic-radar.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
import { DEBUG } from '@glimmer/env';
import { tracked } from '@glimmer/tracking';

import Radar from './radar';
import SkipList from '../skip-list';
import roundTo from '../utils/round-to';
import getScaledClientRect from '../../utils/element/get-scaled-client-rect';

export default class DynamicRadar extends Radar {
constructor(parentToken, options) {
super(parentToken, options);
@tracked _firstItemIndex=0;
@tracked _lastItemIndex=0;

@tracked _totalBefore=0;
@tracked _totalAfter=0;

this._firstItemIndex = 0;
this._lastItemIndex = 0;
@tracked _minHeight = Infinity;

this._totalBefore = 0;
this._totalAfter = 0;
constructor(parentToken, options) {
super(parentToken, options);

this._minHeight = Infinity;

this._nextIncrementalRender = null;

Expand Down
2 changes: 1 addition & 1 deletion addon/-private/data-view/radar/radar.js
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,7 @@ export default class Radar {
this._prevFirstItemIndex += numPrepended;
this._prevLastItemIndex += numPrepended;

this.orderedComponents.forEach((c) => set(c, 'index', get(c, 'index') + numPrepended));
this.orderedComponents.forEach((c) => set(c, 'index', c.index + numPrepended));

this._firstReached = false;

Expand Down
Loading