diff options
| author | aidahosa1 <aisosa_idahosa@brown.edu> | 2024-03-19 16:21:34 -0400 |
|---|---|---|
| committer | aidahosa1 <aisosa_idahosa@brown.edu> | 2024-04-04 04:24:18 -0400 |
| commit | d3383640a8007a15e0deb47715e203508c4fd64a (patch) | |
| tree | 2844d81ab44934e35d8051d28484054f2120cb3d /src/client/views/collections/collectionFreeForm/CollectionFreeFormLayoutEngines.tsx | |
| parent | c0f942d81070d3b77029abc98c50ab3fd5ac2dbe (diff) | |
working on implementing card logic
Diffstat (limited to 'src/client/views/collections/collectionFreeForm/CollectionFreeFormLayoutEngines.tsx')
| -rw-r--r-- | src/client/views/collections/collectionFreeForm/CollectionFreeFormLayoutEngines.tsx | 61 |
1 files changed, 31 insertions, 30 deletions
diff --git a/src/client/views/collections/collectionFreeForm/CollectionFreeFormLayoutEngines.tsx b/src/client/views/collections/collectionFreeForm/CollectionFreeFormLayoutEngines.tsx index e972f44f1..b3ae382e3 100644 --- a/src/client/views/collections/collectionFreeForm/CollectionFreeFormLayoutEngines.tsx +++ b/src/client/views/collections/collectionFreeForm/CollectionFreeFormLayoutEngines.tsx @@ -126,39 +126,40 @@ export function computeStarburstLayout(poolData: Map<string, PoolData>, pivotDoc return normalizeResults(burstDiam, 12, docMap, poolData, viewDefsToJSX, [], 0, [divider]); } -export function computeCardDeckLayout(poolData: Map<string, PoolData>, pivotDoc: Doc, childPairs: { layout: Doc; data?: Doc }[], panelDim: number[], viewDefsToJSX: (views: ViewDefBounds[]) => ViewDefResult[], engineProps: any) { - const docMap = new Map<string, PoolData>(); - const spreadWidth = Math.min(panelDim[0], childPairs.length * 50); // Total width of the spread - const startX = -(spreadWidth / 2); // Starting X position - const fanAngle = 5; // Angle in degrees for fanning out cards - const baseZIndex = 1000; // Base Z-index to ensure cards are stacked in order +// export function computeCardDeckLayout(poolData: Map<string, PoolData>, pivotDoc: Doc, childPairs: { layout: Doc; data?: Doc }[], panelDim: number[], viewDefsToJSX: (views: ViewDefBounds[]) => ViewDefResult[], engineProps: any) { +// console.log('hi'); +// const docMap = new Map<string, PoolData>(); +// const spreadWidth = Math.min(panelDim[0], childPairs.length * 50); // Total width of the spread +// const startX = -(spreadWidth / 2); // Starting X position +// const fanAngle = 5; // Angle in degrees for fanning out cards +// const baseZIndex = 1000; // Base Z-index to ensure cards are stacked in order - childPairs.forEach(({ layout, data }, i) => { - const aspect = NumCast(layout._height) / NumCast(layout._width); - const docSize = Math.min(400, NumCast(layout._width)) * NumCast(pivotDoc._starburstDocScale, 1); - const posX = startX + (spreadWidth / childPairs.length) * i; - const posY = 0; // Adjust if you want to change the vertical alignment - const rotation = (i - (childPairs.length / 2)) * fanAngle; // Calculate rotation for fanning effect +// childPairs.forEach(({ layout, data }, i) => { +// const aspect = NumCast(layout._height) / NumCast(layout._width); +// const docSize = Math.min(400, NumCast(layout._width)) * NumCast(pivotDoc._starburstDocScale, 1); +// const posX = startX + (spreadWidth / childPairs.length) * i; +// const posY = 0; // Adjust if you want to change the vertical alignment +// const rotation = (i - (childPairs.length / 2)) * fanAngle; // Calculate rotation for fanning effect - docMap.set(layout[Id], { - x: posX, - y: posY, - width: docSize, - height: docSize * aspect, - zIndex: baseZIndex + i, // Increment Z-index for each card to stack them correctly - rotation: rotation, // Optional: Add this if you want to rotate elements for a fanned effect - pair: { layout, data }, - replica: '', - color: 'white', - backgroundColor: 'white', - transition: 'all 0.3s', - }); - }); +// docMap.set(layout[Id], { +// x: posX, +// y: posY, +// width: docSize, +// height: docSize * aspect, +// zIndex: baseZIndex + i, +// rotation: rotation, +// pair: { layout, data }, +// replica: '', +// color: 'white', +// backgroundColor: 'white', +// transition: 'all 0.3s', +// }); +// }); - // This is a placeholder for the divider object and may need to be adjusted based on actual usage - const divider = { type: 'div', color: 'transparent', x: -panelDim[0] / 2, y: -panelDim[1] / 2, width: 15, height: 15, payload: undefined }; - return normalizeResults(panelDim, 12, docMap, poolData, viewDefsToJSX, [], 0, [divider]); -} +// // This is a placeholder for the divider object and may need to be adjusted based on actual usage +// const divider = { type: 'div', color: 'transparent', x: -panelDim[0] / 2, y: -panelDim[1] / 2, width: 15, height: 15, payload: undefined }; +// return normalizeResults(panelDim, 12, docMap, poolData, viewDefsToJSX, [], 0, [divider]); +// } export function computePivotLayout(poolData: Map<string, PoolData>, pivotDoc: Doc, childPairs: { layout: Doc; data?: Doc }[], panelDim: number[], viewDefsToJSX: (views: ViewDefBounds[]) => ViewDefResult[], engineProps: any) { const docMap = new Map<string, PoolData>(); |
