Skip to content

Commit

Permalink
Rewrite VerticalCollection to a GlimmerComponent
Browse files Browse the repository at this point in the history
  • Loading branch information
mixonic committed Sep 20, 2023
1 parent a52ab83 commit be4d77e
Show file tree
Hide file tree
Showing 11 changed files with 136 additions and 82 deletions.
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

0 comments on commit be4d77e

Please sign in to comment.