aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2024-10-07 10:43:48 -0400
committerbobzel <zzzman@gmail.com>2024-10-07 10:43:48 -0400
commitcd7e213e7e0b9b6606ae068c29412bb64cdf6f2d (patch)
treea6b5572b6d186ade75a32886d53f46268d06947f /src
parentf63aa4c65f6336c7708c50ced83867702a310240 (diff)
comment cleanup
Diffstat (limited to 'src')
-rw-r--r--src/client/views/collections/CollectionCardDeckView.tsx24
1 files changed, 11 insertions, 13 deletions
diff --git a/src/client/views/collections/CollectionCardDeckView.tsx b/src/client/views/collections/CollectionCardDeckView.tsx
index a9ab9de26..0c2bcc580 100644
--- a/src/client/views/collections/CollectionCardDeckView.tsx
+++ b/src/client/views/collections/CollectionCardDeckView.tsx
@@ -411,15 +411,14 @@ export class CollectionCardView extends CollectionSubView() {
translateOverflowX = (realIndex: number, calcRowCards: number) => (realIndex < this._maxRowCount ? 0 : (this._maxRowCount - calcRowCards) * (this.childPanelWidth() / 2));
/**
- * Determines how far to translate a card in the y direction depending on its index, whether or not its being hovered, or if it's selected
- * @param isHovered
- * @param isActive
- * @param realIndex
- * @param amCards
- * @param calcRowIndex
- * @returns
+ * Determines how far to translate a card in the y direction depending on its index and if it's selected
+ * @param isActive whether the card is focused for interaction
+ * @param realIndex index of card from start of deck
+ * @param amCards ??
+ * @param calcRowIndex index of card from start of row
+ * @returns Y translation of card
*/
- calculateTranslateY = (isHovered: boolean, isActive: boolean, realIndex: number, amCards: number, calcRowIndex: number) => {
+ calculateTranslateY = (isActive: boolean, realIndex: number, amCards: number, calcRowIndex: number) => {
const rowHeight = (this._props.PanelHeight() * this.fitContentScale) / this.numRows;
const rowIndex = Math.trunc(realIndex / this._maxRowCount);
const rowToCenterShift = this.numRows / 2 - rowIndex;
@@ -592,9 +591,8 @@ export class CollectionCardView extends CollectionSubView() {
// Map sorted documents to their rendered components
return this.sortedDocs.map((doc, index) => {
- const realIndex = this.sortedDocs.indexOf(doc);
- const calcRowIndex = this.overflowIndexCalc(realIndex);
- const amCards = this.overflowAmCardsCalc(realIndex);
+ const calcRowIndex = this.overflowIndexCalc(index);
+ const amCards = this.overflowAmCardsCalc(index);
const view = DocumentView.getDocumentView(doc, this.DocumentView?.());
const childScreenToLocal = this.childScreenToLocal(doc, index, calcRowIndex, !!view?.IsContentActive, amCards);
@@ -617,8 +615,8 @@ export class CollectionCardView extends CollectionSubView() {
style={{
width: this.childPanelWidth(),
height: 'max-content',
- transform: `translateY(${this.calculateTranslateY(this._hoveredNodeIndex === index, !!view?.IsContentActive, realIndex, amCards, calcRowIndex)}px)
- translateX(calc(${view?.IsContentActive ? translateIfSelected() : 0}% + ${this.translateOverflowX(realIndex, amCards)}px))
+ transform: `translateY(${this.calculateTranslateY(!!view?.IsContentActive, index, amCards, calcRowIndex)}px)
+ translateX(calc(${view?.IsContentActive ? translateIfSelected() : 0}% + ${this.translateOverflowX(index, amCards)}px))
rotate(${!view?.IsContentActive ? this.rotate(amCards, calcRowIndex) : 0}deg)
scale(${view?.IsContentActive ? `${Math.min(hscale, vscale) * 100}%` : this._hoveredNodeIndex === index ? 1.1 : 1})`,
}} // prettier-ignore