Skip to content

Commit 1a5b026

Browse files
committed
fix: Colors and border radii
1 parent 88a0236 commit 1a5b026

File tree

6 files changed

+58
-35
lines changed

6 files changed

+58
-35
lines changed

filer/private/sass/components/_drag-and-drop.scss

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ form .form-row {
2323
position: relative;
2424
min-width: 215px;
2525
border: solid 1px $gray-lighter;
26-
border-radius: $border-radius-base;
26+
border-radius: $border-radius-normal;
2727
background-color: $gray-lightest;
2828
box-sizing: border-box !important;
2929
.z-index-fix {
@@ -171,7 +171,7 @@ form .form-row {
171171
margin-right: 10px;
172172
}
173173
.filerFile .related-lookup {
174-
@include button-variant($btn-action-color, $btn-action-bgcolor, $btn-action-border, true);
174+
@include button-variant($btn-action-color, var(--primary), $btn-action-border, true);
175175
float: left !important;
176176
overflow: hidden;
177177
// makes true that button has correct height #668
@@ -265,13 +265,13 @@ form .form-row {
265265
height: 80px;
266266
margin-right: 10px;
267267
border: solid 1px $gray-lighter;
268-
border-radius: $border-radius-base;
268+
border-radius: 0;
269269
vertical-align: top;
270270
&[src*="nofile"] {
271271
box-sizing: border-box;
272272
margin-right: 0;
273273
border: solid 1px $gray-lighter;
274-
border-radius: $border-radius-base;
274+
border-radius: 0;
275275
}
276276
}
277277
// required for django CMS <= 3.1

filer/private/sass/settings/_custom.scss

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ $btn-default-color: var(--dca-gray-light, var(--button-fg, #999));
6060
$btn-default-bgcolor: var(--dca-white, var(--button-bg, #fff));
6161
$btn-default-border: var(--dca-gray-lighter, transparent);
6262

63-
$btn-action-color: var(--dca-white, var(--button-fg, #fff));
64-
$btn-action-bgcolor: $color-primary;
65-
$btn-action-border: $color-primary;
63+
$btn-action-color: var(--default-button-fg, var(--button-fg, #fff));
64+
$btn-action-bgcolor: var(--default-button-bg);
65+
$btn-action-border: $black;
6666

6767
//##############################################################################
6868
// #SHADOW

filer/static/filer/css/admin_filer.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

filer/static/filer/js/addons/focal-point.js

Lines changed: 41 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -115,15 +115,19 @@ window.Cl = window.Cl || {};
115115
event.preventDefault();
116116
this.isDragging = true;
117117

118-
const clientX = event.type === 'touchstart' ? event.touches[0].clientX : event.clientX;
119-
const clientY = event.type === 'touchstart' ? event.touches[0].clientY : event.clientY;
118+
const touch = event.type === 'touchstart' ? event.touches[0] : event;
120119

121-
this.dragStartX = clientX;
122-
this.dragStartY = clientY;
120+
// Get container bounds
121+
const containerRect = this.container.getBoundingClientRect();
122+
123+
// Calculate mouse position relative to container
124+
this.dragStartX = touch.clientX - containerRect.left;
125+
this.dragStartY = touch.clientY - containerRect.top;
123126

124-
const rect = this.circle.getBoundingClientRect();
125-
this.circleStartX = rect.left;
126-
this.circleStartY = rect.top;
127+
// Get current circle position (center)
128+
const circleRect = this.circle.getBoundingClientRect();
129+
this.circleStartX = circleRect.left - containerRect.left + circleRect.width;
130+
this.circleStartY = circleRect.top - containerRect.top + circleRect.height;
127131

128132
document.addEventListener('mousemove', this._onMouseMove);
129133
document.addEventListener('mouseup', this._onMouseUp);
@@ -136,33 +140,36 @@ window.Cl = window.Cl || {};
136140

137141
event.preventDefault();
138142

139-
const clientX = event.type === 'touchmove' ? event.touches[0].clientX : event.clientX;
140-
const clientY = event.type === 'touchmove' ? event.touches[0].clientY : event.clientY;
141-
142-
const deltaX = clientX - this.dragStartX;
143-
const deltaY = clientY - this.dragStartY;
143+
const touch = event.type === 'touchmove' ? event.touches[0] : event;
144144

145+
// Get container bounds
145146
const containerRect = this.container.getBoundingClientRect();
146-
const circleRect = this.circle.getBoundingClientRect();
147147

148-
let newX = this.circleStartX - containerRect.left + deltaX;
149-
let newY = this.circleStartY - containerRect.top + deltaY;
148+
// Calculate current mouse position relative to container
149+
const currentX = touch.clientX - containerRect.left;
150+
const currentY = touch.clientY - containerRect.top;
150151

151-
// Constrain to container bounds
152-
const minX = 0;
153-
const minY = 0;
154-
const maxX = containerRect.width - circleRect.width;
155-
const maxY = containerRect.height - circleRect.height;
152+
// Calculate how much the mouse moved
153+
const deltaX = currentX - this.dragStartX;
154+
const deltaY = currentY - this.dragStartY;
156155

157-
newX = Math.max(minX, Math.min(maxX, newX));
158-
newY = Math.max(minY, Math.min(maxY, newY));
156+
// Calculate new center position
157+
let centerX = this.circleStartX + deltaX;
158+
let centerY = this.circleStartY + deltaY;
159159

160-
this.circle.style.left = `${newX}px`;
161-
this.circle.style.top = `${newY}px`;
160+
// Get circle dimensions
161+
const circleRect = this.circle.getBoundingClientRect();
162+
const halfCircle = circleRect.width / 2;
162163

163-
// Update location value (center of circle)
164-
const centerX = newX + circleRect.width / 2;
165-
const centerY = newY + circleRect.height / 2;
164+
// Constrain center to container bounds
165+
centerX = Math.max(halfCircle, Math.min(containerRect.width + halfCircle, centerX));
166+
centerY = Math.max(halfCircle, Math.min(containerRect.height + halfCircle, centerY));
167+
168+
// Position circle by its top-left corner (center - radius)
169+
this.circle.style.left = `${centerX - halfCircle}px`;
170+
this.circle.style.top = `${centerY - halfCircle}px`;
171+
172+
// Update location value with center coordinates
166173
this._updateLocationValue(centerX, centerY);
167174
}
168175

@@ -237,4 +244,11 @@ window.Cl = window.Cl || {};
237244

238245
window.Cl.FocalPoint = FocalPoint;
239246
window.Cl.FocalPointConstructor = FocalPointConstructor;
247+
248+
// Export for ES6 module usage
249+
if (typeof module !== 'undefined' && module.exports) {
250+
module.exports = FocalPoint;
251+
}
240252
})();
253+
254+
export default window.Cl.FocalPoint;

filer/static/filer/js/addons/toggler.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,3 +78,5 @@ class TogglerConstructor {
7878

7979
Cl.Toggler = Toggler;
8080
Cl.TogglerConstructor = TogglerConstructor;
81+
82+
export default Toggler;

filer/static/filer/js/base.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,4 +401,11 @@ document.addEventListener('DOMContentLoaded', () => {
401401
}, 1200);
402402
});
403403
});
404+
405+
// Initialize FocalPoint
406+
const focalPoint = new FocalPoint();
407+
focalPoint.initialize();
408+
409+
// Initialize Toggler (auto-initializes in constructor)
410+
new Toggler();
404411
});

0 commit comments

Comments
 (0)