#45 These buttons don't work and dropdown is broken commit reverted

This commit is contained in:
Agriya Dev5
2021-02-17 16:28:22 +05:30
parent 2f2dd0fc56
commit 79667bb459
3 changed files with 5 additions and 16 deletions

View File

@@ -130,7 +130,6 @@ export class SeList extends HTMLElement {
const value = this.$dropdown.selectedItem.getAttribute('value'); const value = this.$dropdown.selectedItem.getAttribute('value');
const closeEvent = new CustomEvent('change', {detail: {value}}); const closeEvent = new CustomEvent('change', {detail: {value}});
currentObj.dispatchEvent(closeEvent); currentObj.dispatchEvent(closeEvent);
currentObj.value = value;
} }
}); });
} }

View File

@@ -398,11 +398,7 @@ class TopPanelHandlers {
* @returns {void} * @returns {void}
*/ */
clickAlign (pos) { clickAlign (pos) {
let value = $('#tool_align_relative').val(); this.svgCanvas.alignSelectedElements(pos, $('#align_relative_to').val());
if(value === ''){
value = 'selected';
}
this.svgCanvas.alignSelectedElements(pos, value);
} }
/** /**
* *

View File

@@ -288,9 +288,9 @@ export const alignSelectedElements = function (type, relativeTo) {
// now bbox is axis-aligned and handles rotation // now bbox is axis-aligned and handles rotation
switch (relativeTo) { switch (relativeTo) {
case 'smallest': case 'smallest':
if (((type === 'l' || type === 'c' || type === 'r' || type === 'left' || type === 'center' || type === 'right') && if (((type === 'l' || type === 'c' || type === 'r') &&
(curwidth === Number.MIN_VALUE || curwidth > bboxes[i].width)) || (curwidth === Number.MIN_VALUE || curwidth > bboxes[i].width)) ||
((type === 't' || type === 'm' || type === 'b' || type === 'top' || type === 'middle' || type === 'bottom') && ((type === 't' || type === 'm' || type === 'b') &&
(curheight === Number.MIN_VALUE || curheight > bboxes[i].height)) (curheight === Number.MIN_VALUE || curheight > bboxes[i].height))
) { ) {
minx = bboxes[i].x; minx = bboxes[i].x;
@@ -302,9 +302,9 @@ export const alignSelectedElements = function (type, relativeTo) {
} }
break; break;
case 'largest': case 'largest':
if (((type === 'l' || type === 'c' || type === 'r' || type === 'left' || type === 'center' || type === 'right') && if (((type === 'l' || type === 'c' || type === 'r') &&
(curwidth === Number.MIN_VALUE || curwidth < bboxes[i].width)) || (curwidth === Number.MIN_VALUE || curwidth < bboxes[i].width)) ||
((type === 't' || type === 'm' || type === 'b' || type === 'top' || type === 'middle' || type === 'bottom') && ((type === 't' || type === 'm' || type === 'b') &&
(curheight === Number.MIN_VALUE || curheight < bboxes[i].height)) (curheight === Number.MIN_VALUE || curheight < bboxes[i].height))
) { ) {
minx = bboxes[i].x; minx = bboxes[i].x;
@@ -341,27 +341,21 @@ export const alignSelectedElements = function (type, relativeTo) {
dy[i] = 0; dy[i] = 0;
switch (type) { switch (type) {
case 'l': // left (horizontal) case 'l': // left (horizontal)
case 'left': // left (horizontal)
dx[i] = minx - bbox.x; dx[i] = minx - bbox.x;
break; break;
case 'c': // center (horizontal) case 'c': // center (horizontal)
case 'center': // center (horizontal)
dx[i] = (minx + maxx) / 2 - (bbox.x + bbox.width / 2); dx[i] = (minx + maxx) / 2 - (bbox.x + bbox.width / 2);
break; break;
case 'r': // right (horizontal) case 'r': // right (horizontal)
case 'right': // right (horizontal)
dx[i] = maxx - (bbox.x + bbox.width); dx[i] = maxx - (bbox.x + bbox.width);
break; break;
case 't': // top (vertical) case 't': // top (vertical)
case 'top': // top (vertical)
dy[i] = miny - bbox.y; dy[i] = miny - bbox.y;
break; break;
case 'm': // middle (vertical) case 'm': // middle (vertical)
case 'middle': // middle (vertical)
dy[i] = (miny + maxy) / 2 - (bbox.y + bbox.height / 2); dy[i] = (miny + maxy) / 2 - (bbox.y + bbox.height / 2);
break; break;
case 'b': // bottom (vertical) case 'b': // bottom (vertical)
case 'bottom': // bottom (vertical)
dy[i] = maxy - (bbox.y + bbox.height); dy[i] = maxy - (bbox.y + bbox.height);
break; break;
} }