MCPcopy Create free account
hub / github.com/error311/FileRise / createCardGhost

Function createCardGhost

public/js/dragAndDrop.js:95–193  ·  view source on GitHub ↗
(card, rect, opts)

Source from the content-addressed store, hash-verified

93}
94
95function createCardGhost(card, rect, opts) {
96 const options = opts || {};
97 const scale = typeof options.scale === 'number' ? options.scale : 1;
98 const opacity = typeof options.opacity === 'number' ? options.opacity : 1;
99 const transformOrigin = typeof options.transformOrigin === 'string'
100 ? options.transformOrigin
101 : 'center center';
102 const materialIcon = typeof options.materialIcon === 'string' ? options.materialIcon : '';
103 const materialIconOpacity = typeof options.materialIconOpacity === 'number' ? options.materialIconOpacity : 0;
104 const materialIconScale = typeof options.materialIconScale === 'number' ? options.materialIconScale : 1.15;
105 const bodyOpacity = typeof options.bodyOpacity === 'number' ? options.bodyOpacity : 0.6;
106 const appZoomScale = getAppZoomScale();
107
108 const cs = window.getComputedStyle(card);
109
110 const wrap = document.createElement('div');
111 wrap.className = 'card-ghost-wrap';
112
113 Object.assign(wrap.style, {
114 position: 'fixed',
115 left: rect.left + 'px',
116 top: rect.top + 'px',
117 width: rect.width + 'px',
118 height: rect.height + 'px',
119 margin: '0',
120 zIndex: '12000',
121 pointerEvents: 'none',
122 transformOrigin,
123 transform: 'scale(' + scale + ')',
124 opacity: String(opacity),
125
126 backgroundColor: cs.backgroundColor || 'rgba(24,24,24,.96)',
127 borderRadius: cs.borderRadius || '',
128 boxShadow: cs.boxShadow || '',
129 borderColor: cs.borderColor || '',
130 borderWidth: cs.borderWidth || '',
131 borderStyle: cs.borderStyle || '',
132 backdropFilter: cs.backdropFilter || '',
133
134 // ✨ make the ghost crisper
135 overflow: 'hidden',
136 willChange: 'transform, opacity',
137 backfaceVisibility: 'hidden'
138 });
139
140 const ghost = card.cloneNode(true);
141 Object.assign(ghost.style, {
142 position: 'absolute',
143 left: '0',
144 top: '0',
145 zIndex: '1',
146 width: (rect.width / appZoomScale) + 'px',
147 height: (rect.height / appZoomScale) + 'px',
148 margin: '0',
149 pointerEvents: 'none',
150 transformOrigin: 'top left',
151 transform: `scale(${appZoomScale})`,
152 backgroundColor: 'transparent',

Callers 2

Calls 1

getAppZoomScaleFunction · 0.85

Tested by

no test coverage detected