diff --git a/src/actions/actionDuplicateSelection.tsx b/src/actions/actionDuplicateSelection.tsx
index 91e80183..b48a0b6d 100644
--- a/src/actions/actionDuplicateSelection.tsx
+++ b/src/actions/actionDuplicateSelection.tsx
@@ -18,6 +18,7 @@ import {
import { AppState } from "../types";
import { fixBindingsAfterDuplication } from "../element/binding";
import { ActionResult } from "./types";
+import { GRID_SIZE } from "../constants";
export const actionDuplicateSelection = register({
name: "duplicateSelection",
@@ -93,8 +94,8 @@ const duplicateElements = (
groupIdMap,
element,
{
- x: element.x + 10,
- y: element.y + 10,
+ x: element.x + GRID_SIZE / 2,
+ y: element.y + GRID_SIZE / 2,
},
);
oldIdToDuplicatedId.set(element.id, newElement.id);
diff --git a/src/components/LayerUI.scss b/src/components/LayerUI.scss
index a9a80931..f77dde39 100644
--- a/src/components/LayerUI.scss
+++ b/src/components/LayerUI.scss
@@ -6,6 +6,16 @@
display: flex;
align-items: center;
justify-content: center;
+
+ .browse-libraries {
+ position: absolute;
+ right: 12px;
+ top: 16px;
+ white-space: nowrap;
+ max-width: 140px;
+ text-overflow: ellipsis;
+ overflow: hidden;
+ }
}
.layer-ui__library-message {
diff --git a/src/components/LayerUI.tsx b/src/components/LayerUI.tsx
index c6a06b89..9fd09d5d 100644
--- a/src/components/LayerUI.tsx
+++ b/src/components/LayerUI.tsx
@@ -118,70 +118,83 @@ const LibraryMenuItems = ({
let addedPendingElements = false;
rows.push(
-
-
+ {
- importLibraryFromJSON()
- .then(() => {
- // Maybe we should close and open the menu so that the items get updated.
- // But for now we just close the menu.
- setAppState({ isLibraryOpen: false });
- })
- .catch(muteFSAbortError)
- .catch((error) => {
- setAppState({ errorMessage: error.message });
- });
+ trackEvent(EVENT_EXIT, "libraries");
}}
- />
- {
- saveLibraryAsJSON()
- .catch(muteFSAbortError)
- .catch((error) => {
- setAppState({ errorMessage: error.message });
- });
- }}
- />
- ,
+ >
+ {t("labels.libraries")}
+
+
+
+ {
+ importLibraryFromJSON()
+ .then(() => {
+ // Maybe we should close and open the menu so that the items get updated.
+ // But for now we just close the menu.
+ setAppState({ isLibraryOpen: false });
+ })
+ .catch(muteFSAbortError)
+ .catch((error) => {
+ setAppState({ errorMessage: error.message });
+ });
+ }}
+ />
+ {
+ saveLibraryAsJSON()
+ .catch(muteFSAbortError)
+ .catch((error) => {
+ setAppState({ errorMessage: error.message });
+ });
+ }}
+ />
+
+ >,
);
for (let row = 0; row < numRows; row++) {
- const i = CELLS_PER_ROW * row;
+ const y = CELLS_PER_ROW * row;
const children = [];
- for (let j = 0; j < CELLS_PER_ROW; j++) {
+ for (let x = 0; x < CELLS_PER_ROW; x++) {
const shouldAddPendingElements: boolean =
pendingElements.length > 0 &&
!addedPendingElements &&
- i + j >= library.length;
+ y + x >= library.length;
addedPendingElements = addedPendingElements || shouldAddPendingElements;
children.push(
-
+
,
diff --git a/src/locales/en.json b/src/locales/en.json
index 4c8271f1..aacfedae 100644
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@ -75,6 +75,7 @@
"addToLibrary": "Add to library",
"removeFromLibrary": "Remove from library",
"libraryLoadingMessage": "Loading library...",
+ "libraries": "Browse libraries",
"loadingScene": "Loading scene...",
"align": "Align",
"alignTop": "Align top",