mirror of
https://github.com/zen-browser/desktop.git
synced 2025-10-17 07:16:16 +00:00
fixed formatting
This commit is contained in:
@@ -250,7 +250,6 @@
|
|||||||
transition: transform 0.2s;
|
transition: transform 0.2s;
|
||||||
transform: translate(-50%, -50%);
|
transform: translate(-50%, -50%);
|
||||||
|
|
||||||
|
|
||||||
&[dragging='true'] {
|
&[dragging='true'] {
|
||||||
transform: scale(1.2) translate(-50%, -50%) !important;
|
transform: scale(1.2) translate(-50%, -50%) !important;
|
||||||
}
|
}
|
||||||
|
@@ -180,7 +180,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
initThemePicker() {
|
initThemePicker() {
|
||||||
const themePicker = this.panel.querySelector('.zen-theme-picker-gradient');
|
const themePicker = this.panel.querySelector('.zen-theme-picker-gradient');
|
||||||
themePicker.style.setProperty('--zen-theme-picker-gradient-image', `url(${ZenThemePicker.GRADIENT_DISPLAY_URL})`);
|
themePicker.style.setProperty('--zen-theme-picker-gradient-image', `url(${ZenThemePicker.GRADIENT_DISPLAY_URL})`);
|
||||||
@@ -254,7 +253,7 @@
|
|||||||
this.dots.push({
|
this.dots.push({
|
||||||
ID: id,
|
ID: id,
|
||||||
Element: dot,
|
Element: dot,
|
||||||
Position: { x: parseFloat(dot.style.left), y: parseFloat(dot.style.top) }
|
Position: { x: parseFloat(dot.style.left), y: parseFloat(dot.style.top) },
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (!fromWorkspace) {
|
if (!fromWorkspace) {
|
||||||
@@ -313,7 +312,7 @@
|
|||||||
let id = this.dots.length;
|
let id = this.dots.length;
|
||||||
|
|
||||||
if (primary === true) {
|
if (primary === true) {
|
||||||
id = 0
|
id = 0;
|
||||||
const existingPrimaryDot = this.dots.find((d) => d.ID === 0);
|
const existingPrimaryDot = this.dots.find((d) => d.ID === 0);
|
||||||
if (existingPrimaryDot) {
|
if (existingPrimaryDot) {
|
||||||
existingPrimaryDot.ID = this.dots.length;
|
existingPrimaryDot.ID = this.dots.length;
|
||||||
@@ -323,11 +322,10 @@
|
|||||||
const colorFromPos = this.getColorFromPosition(relativePosition.x, relativePosition.y);
|
const colorFromPos = this.getColorFromPosition(relativePosition.x, relativePosition.y);
|
||||||
dot.style.setProperty('--zen-theme-picker-dot-color', `rgb(${colorFromPos[0]}, ${colorFromPos[1]}, ${colorFromPos[2]})`);
|
dot.style.setProperty('--zen-theme-picker-dot-color', `rgb(${colorFromPos[0]}, ${colorFromPos[1]}, ${colorFromPos[2]})`);
|
||||||
|
|
||||||
|
|
||||||
this.dots.push({
|
this.dots.push({
|
||||||
ID: id,
|
ID: id,
|
||||||
Element: dot,
|
Element: dot,
|
||||||
Position: { x: parseFloat(dot.style.left), y: parseFloat(dot.style.top) }
|
Position: { x: parseFloat(dot.style.left), y: parseFloat(dot.style.top) },
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -410,17 +408,23 @@
|
|||||||
if (existingPrimaryDot) {
|
if (existingPrimaryDot) {
|
||||||
existingPrimaryDot.Element.style.zIndex = 999;
|
existingPrimaryDot.Element.style.zIndex = 999;
|
||||||
const colorFromPos = this.getColorFromPosition(existingPrimaryDot.Position.x, existingPrimaryDot.Position.y);
|
const colorFromPos = this.getColorFromPosition(existingPrimaryDot.Position.x, existingPrimaryDot.Position.y);
|
||||||
existingPrimaryDot.Element.style.setProperty('--zen-theme-picker-dot-color', `rgb(${colorFromPos[0]}, ${colorFromPos[1]}, ${colorFromPos[2]})`);
|
existingPrimaryDot.Element.style.setProperty(
|
||||||
|
'--zen-theme-picker-dot-color',
|
||||||
|
`rgb(${colorFromPos[0]}, ${colorFromPos[1]}, ${colorFromPos[2]})`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
colorPositions.forEach(dotPosition => {
|
colorPositions.forEach((dotPosition) => {
|
||||||
const existingDot = this.dots.find(dot => dot.ID === dotPosition.ID);
|
const existingDot = this.dots.find((dot) => dot.ID === dotPosition.ID);
|
||||||
|
|
||||||
if (existingDot) {
|
if (existingDot) {
|
||||||
existingDot.Position = dotPosition.Position;
|
existingDot.Position = dotPosition.Position;
|
||||||
existingDot.Element.style.left = `${dotPosition.Position.x}px`;
|
existingDot.Element.style.left = `${dotPosition.Position.x}px`;
|
||||||
existingDot.Element.style.top = `${dotPosition.Position.y}px`;
|
existingDot.Element.style.top = `${dotPosition.Position.y}px`;
|
||||||
const colorFromPos = this.getColorFromPosition(dotPosition.Position.x, dotPosition.Position.y);
|
const colorFromPos = this.getColorFromPosition(dotPosition.Position.x, dotPosition.Position.y);
|
||||||
existingDot.Element.style.setProperty('--zen-theme-picker-dot-color', `rgb(${colorFromPos[0]}, ${colorFromPos[1]}, ${colorFromPos[2]})`);
|
existingDot.Element.style.setProperty(
|
||||||
|
'--zen-theme-picker-dot-color',
|
||||||
|
`rgb(${colorFromPos[0]}, ${colorFromPos[1]}, ${colorFromPos[2]})`
|
||||||
|
);
|
||||||
|
|
||||||
if (!this.dragging) {
|
if (!this.dragging) {
|
||||||
gZenUIManager.motion.animate(
|
gZenUIManager.motion.animate(
|
||||||
@@ -442,7 +446,6 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
onThemePickerClick(event) {
|
onThemePickerClick(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
@@ -481,22 +484,19 @@
|
|||||||
const relativeY = event.clientY - rect.top;
|
const relativeY = event.clientY - rect.top;
|
||||||
|
|
||||||
if (!clickedDot && this.dots.length < 1) {
|
if (!clickedDot && this.dots.length < 1) {
|
||||||
|
|
||||||
if (this.dots.length === 0) {
|
if (this.dots.length === 0) {
|
||||||
this.spawnDot({ x: relativeX, y: relativeY }, true);
|
this.spawnDot({ x: relativeX, y: relativeY }, true);
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
this.spawnDot({ x: relativeX, y: relativeY });
|
this.spawnDot({ x: relativeX, y: relativeY });
|
||||||
}
|
}
|
||||||
|
|
||||||
this.updateCurrentWorkspace(true);
|
this.updateCurrentWorkspace(true);
|
||||||
}
|
} else if (!clickedDot && existingPrimaryDot) {
|
||||||
else if (!clickedDot && existingPrimaryDot) {
|
|
||||||
existingPrimaryDot.Element.style.left = `${relativeX}px`;
|
existingPrimaryDot.Element.style.left = `${relativeX}px`;
|
||||||
existingPrimaryDot.Element.style.top = `${relativeY}px`;
|
existingPrimaryDot.Element.style.top = `${relativeY}px`;
|
||||||
existingPrimaryDot.Position = {
|
existingPrimaryDot.Position = {
|
||||||
x: relativeX,
|
x: relativeX,
|
||||||
y: relativeY
|
y: relativeY,
|
||||||
};
|
};
|
||||||
|
|
||||||
let colorPositions = this.calculateCompliments(this.dots, true);
|
let colorPositions = this.calculateCompliments(this.dots, true);
|
||||||
@@ -522,7 +522,7 @@
|
|||||||
if (event.button === 2) {
|
if (event.button === 2) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const draggedDot = this.dots.find(dot => dot.Element === event.target)
|
const draggedDot = this.dots.find((dot) => dot.Element === event.target);
|
||||||
if (draggedDot) {
|
if (draggedDot) {
|
||||||
this.dragging = true;
|
this.dragging = true;
|
||||||
this.draggedDot = event.target;
|
this.draggedDot = event.target;
|
||||||
@@ -541,7 +541,7 @@
|
|||||||
if (!event.target.classList.contains('zen-theme-picker-dot')) {
|
if (!event.target.classList.contains('zen-theme-picker-dot')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.dots = this.dots.filter(dot => dot.Element !== event.target);
|
this.dots = this.dots.filter((dot) => dot.Element !== event.target);
|
||||||
event.target.remove();
|
event.target.remove();
|
||||||
let colorPositions = this.calculateCompliments(this.dots, true);
|
let colorPositions = this.calculateCompliments(this.dots, true);
|
||||||
this.handleColorPositions(colorPositions);
|
this.handleColorPositions(colorPositions);
|
||||||
@@ -566,7 +566,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
onDotMouseMove(event) {
|
onDotMouseMove(event) {
|
||||||
if (this.dragging) {
|
if (this.dragging) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
@@ -592,12 +591,12 @@
|
|||||||
const relativeX = pixelX - rect.left;
|
const relativeX = pixelX - rect.left;
|
||||||
const relativeY = pixelY - rect.top;
|
const relativeY = pixelY - rect.top;
|
||||||
|
|
||||||
const draggedDot = this.dots.find(dot => dot.Element === this.draggedDot)
|
const draggedDot = this.dots.find((dot) => dot.Element === this.draggedDot);
|
||||||
draggedDot.Element.style.left = `${relativeX}px`;
|
draggedDot.Element.style.left = `${relativeX}px`;
|
||||||
draggedDot.Element.style.top = `${relativeY}px`;
|
draggedDot.Element.style.top = `${relativeY}px`;
|
||||||
draggedDot.Position = {
|
draggedDot.Position = {
|
||||||
x: relativeX,
|
x: relativeX,
|
||||||
y: relativeY
|
y: relativeY,
|
||||||
};
|
};
|
||||||
let colorPositions = this.calculateCompliments(this.dots, true);
|
let colorPositions = this.calculateCompliments(this.dots, true);
|
||||||
this.handleColorPositions(colorPositions);
|
this.handleColorPositions(colorPositions);
|
||||||
|
Reference in New Issue
Block a user