diff --git a/extlib/fs/directory-open.mjs b/extlib/fs/directory-open.mjs
deleted file mode 100644
index e51d720..0000000
--- a/extlib/fs/directory-open.mjs
+++ /dev/null
@@ -1,32 +0,0 @@
-/**
- * Copyright 2020 Google LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-// @license © 2020 Google LLC. Licensed under the Apache License, Version 2.0.
-
-import supported from './supported.mjs';
-
-const implementation = !supported
- ? import('./legacy/directory-open.mjs')
- : supported === 'chooseFileSystemEntries'
- ? import('./fs-access-legacy/directory-open.mjs')
- : import('./fs-access/directory-open.mjs');
-
-/**
- * For opening directories, dynamically either loads the File System Access API
- * module or the legacy method.
- */
-export async function directoryOpen(...args) {
- return (await implementation).default(...args);
-}
diff --git a/extlib/fs/file-open.mjs b/extlib/fs/file-open.mjs
deleted file mode 100644
index 407082c..0000000
--- a/extlib/fs/file-open.mjs
+++ /dev/null
@@ -1,32 +0,0 @@
-/**
- * Copyright 2020 Google LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-// @license © 2020 Google LLC. Licensed under the Apache License, Version 2.0.
-
-import supported from './supported.mjs';
-
-const implementation = !supported
- ? import('./legacy/file-open.mjs')
- : supported === 'chooseFileSystemEntries'
- ? import('./fs-access-legacy/file-open.mjs')
- : import('./fs-access/file-open.mjs');
-
-/**
- * For opening files, dynamically either loads the File System Access API module
- * or the legacy method.
- */
-export async function fileOpen(...args) {
- return (await implementation).default(...args);
-}
diff --git a/extlib/fs/file-save.mjs b/extlib/fs/file-save.mjs
deleted file mode 100644
index 8364a05..0000000
--- a/extlib/fs/file-save.mjs
+++ /dev/null
@@ -1,32 +0,0 @@
-/**
- * Copyright 2020 Google LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-// @license © 2020 Google LLC. Licensed under the Apache License, Version 2.0.
-
-import supported from './supported.mjs';
-
-const implementation = !supported
- ? import('./legacy/file-save.mjs')
- : supported === 'chooseFileSystemEntries'
- ? import('./fs-access-legacy/file-save.mjs')
- : import('./fs-access/file-save.mjs');
-
-/**
- * For saving files, dynamically either loads the File System Access API module
- * or the legacy method.
- */
-export async function fileSave(...args) {
- return (await implementation).default(...args);
-}
diff --git a/extlib/fs/fs-access-legacy/directory-open.mjs b/extlib/fs/fs-access-legacy/directory-open.mjs
deleted file mode 100644
index e921f95..0000000
--- a/extlib/fs/fs-access-legacy/directory-open.mjs
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * Copyright 2020 Google LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-// @license © 2020 Google LLC. Licensed under the Apache License, Version 2.0.
-
-const getFiles = async (dirHandle, recursive, path = dirHandle.name) => {
- const dirs = [];
- const files = [];
- for await (const entry of dirHandle.getEntries()) {
- const nestedPath = `${path}/${entry.name}`;
- if (entry.isFile) {
- files.push(
- entry.getFile().then((file) =>
- Object.defineProperty(file, 'webkitRelativePath', {
- configurable: true,
- enumerable: true,
- get: () => nestedPath,
- })
- )
- );
- } else if (entry.isDirectory && recursive) {
- dirs.push(getFiles(entry, recursive, nestedPath));
- }
- }
- return [...(await Promise.all(dirs)).flat(), ...(await Promise.all(files))];
-};
-
-/**
- * Opens a directory from disk using the (legacy) File System Access API.
- * @type { typeof import("../../index").directoryOpen }
- */
-export default async (options = {}) => {
- options.recursive = options.recursive || false;
- const handle = await window.chooseFileSystemEntries({
- type: 'open-directory',
- });
- return getFiles(handle, options.recursive);
-};
diff --git a/extlib/fs/fs-access-legacy/file-open.mjs b/extlib/fs/fs-access-legacy/file-open.mjs
deleted file mode 100644
index 2cdfe6b..0000000
--- a/extlib/fs/fs-access-legacy/file-open.mjs
+++ /dev/null
@@ -1,43 +0,0 @@
-/**
- * Copyright 2020 Google LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-// @license © 2020 Google LLC. Licensed under the Apache License, Version 2.0.
-
-const getFileWithHandle = async (handle) => {
- const file = await handle.getFile();
- file.handle = handle;
- return file;
-};
-
-/**
- * Opens a file from disk using the (legacy) File System Access API.
- * @type { typeof import("../../index").fileOpen }
- */
-export default async (options = {}) => {
- const handleOrHandles = await window.chooseFileSystemEntries({
- accepts: [
- {
- description: options.description || '',
- mimeTypes: options.mimeTypes || ['*/*'],
- extensions: options.extensions || [''],
- },
- ],
- multiple: options.multiple || false,
- });
- if (options.multiple) {
- return Promise.all(handleOrHandles.map(getFileWithHandle));
- }
- return getFileWithHandle(handleOrHandles);
-};
diff --git a/extlib/fs/fs-access-legacy/file-save.mjs b/extlib/fs/fs-access-legacy/file-save.mjs
deleted file mode 100644
index 9fe0ca6..0000000
--- a/extlib/fs/fs-access-legacy/file-save.mjs
+++ /dev/null
@@ -1,40 +0,0 @@
-/**
- * Copyright 2020 Google LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-// @license © 2020 Google LLC. Licensed under the Apache License, Version 2.0.
-
-/**
- * Saves a file to disk using the (legacy) File System Access API.
- * @type { typeof import("../../index").fileSave }
- */
-export default async (blob, options = {}, handle = null) => {
- options.fileName = options.fileName || 'Untitled';
- handle =
- handle ||
- (await window.chooseFileSystemEntries({
- type: 'save-file',
- accepts: [
- {
- description: options.description || '',
- mimeTypes: [blob.type],
- extensions: options.extensions || [''],
- },
- ],
- }));
- const writable = await handle.createWritable();
- await writable.write(blob);
- await writable.close();
- return handle;
-};
diff --git a/extlib/fs/fs-access/directory-open.mjs b/extlib/fs/fs-access/directory-open.mjs
deleted file mode 100644
index 19fade2..0000000
--- a/extlib/fs/fs-access/directory-open.mjs
+++ /dev/null
@@ -1,48 +0,0 @@
-/**
- * Copyright 2020 Google LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-// @license © 2020 Google LLC. Licensed under the Apache License, Version 2.0.
-
-const getFiles = async (dirHandle, recursive, path = dirHandle.name) => {
- const dirs = [];
- const files = [];
- for await (const entry of dirHandle.values()) {
- const nestedPath = `${path}/${entry.name}`;
- if (entry.kind === 'file') {
- files.push(
- entry.getFile().then((file) =>
- Object.defineProperty(file, 'webkitRelativePath', {
- configurable: true,
- enumerable: true,
- get: () => nestedPath,
- })
- )
- );
- } else if (entry.kind === 'directory' && recursive) {
- dirs.push(getFiles(entry, recursive, nestedPath));
- }
- }
- return [...(await Promise.all(dirs)).flat(), ...(await Promise.all(files))];
-};
-
-/**
- * Opens a directory from disk using the File System Access API.
- * @type { typeof import("../../index").directoryOpen }
- */
-export default async (options = {}) => {
- options.recursive = options.recursive || false;
- const handle = await window.showDirectoryPicker();
- return getFiles(handle, options.recursive);
-};
diff --git a/extlib/fs/fs-access/file-open.mjs b/extlib/fs/fs-access/file-open.mjs
deleted file mode 100644
index dab1119..0000000
--- a/extlib/fs/fs-access/file-open.mjs
+++ /dev/null
@@ -1,51 +0,0 @@
-/**
- * Copyright 2020 Google LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-// @license © 2020 Google LLC. Licensed under the Apache License, Version 2.0.
-
-const getFileWithHandle = async (handle) => {
- const file = await handle.getFile();
- file.handle = handle;
- return file;
-};
-
-/**
- * Opens a file from disk using the File System Access API.
- * @type { typeof import("../../index").fileOpen }
- */
-export default async (options = {}) => {
- const accept = {};
- if (options.mimeTypes) {
- options.mimeTypes.map((mimeType) => {
- accept[mimeType] = options.extensions || [];
- });
- } else {
- accept['*/*'] = options.extensions || [];
- }
- const handleOrHandles = await window.showOpenFilePicker({
- types: [
- {
- description: options.description || '',
- accept: accept,
- },
- ],
- multiple: options.multiple || false,
- });
- const files = await Promise.all(handleOrHandles.map(getFileWithHandle));
- if (options.multiple) {
- return files;
- }
- return files[0];
-};
diff --git a/extlib/fs/fs-access/file-save.mjs b/extlib/fs/fs-access/file-save.mjs
deleted file mode 100644
index 2ceea07..0000000
--- a/extlib/fs/fs-access/file-save.mjs
+++ /dev/null
@@ -1,67 +0,0 @@
-/**
- * Copyright 2020 Google LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-// @license © 2020 Google LLC. Licensed under the Apache License, Version 2.0.
-
-/**
- * Saves a file to disk using the File System Access API.
- * @type { typeof import("../../index").fileSave }
- */
-export default async (
- blob,
- options = {},
- existingHandle = null,
- throwIfExistingHandleNotGood = false
-) => {
- options.fileName = options.fileName || 'Untitled';
- const accept = {};
- if (options.mimeTypes) {
- options.mimeTypes.push(blob.type);
- options.mimeTypes.map((mimeType) => {
- accept[mimeType] = options.extensions || [];
- });
- console.log(accept,'heeeee')
- } else {
- accept[blob.type] = options.extensions || [];
- }
- if (existingHandle) {
- try {
- // Check if the file still exists.
- await existingHandle.getFile();
- } catch (err) {
- existingHandle = null;
- if (throwIfExistingHandleNotGood) {
- throw err;
- }
- }
- }
-
- console.log(accept)
- const handle =
- existingHandle ||
- (await window.showSaveFilePicker({
- suggestedName: options.fileName,
- types: [
- {
- description: options.description || '',
- accept: accept,
- },
- ],
- }));
- const writable = await handle.createWritable();
- await writable.write(blob);
- await writable.close();
- return handle;
-};
diff --git a/extlib/fs/index.js b/extlib/fs/index.js
deleted file mode 100644
index f67f6df..0000000
--- a/extlib/fs/index.js
+++ /dev/null
@@ -1,24 +0,0 @@
-/**
- * Copyright 2020 Google LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-// @license © 2020 Google LLC. Licensed under the Apache License, Version 2.0.
-
-/**
- * @module browser-fs-access
- */
-export { fileOpen } from './file-open.mjs';
-export { directoryOpen } from './directory-open.mjs';
-export { fileSave } from './file-save.mjs';
-export { default as supported } from './supported.mjs';
diff --git a/extlib/fs/legacy/directory-open.mjs b/extlib/fs/legacy/directory-open.mjs
deleted file mode 100644
index e58a870..0000000
--- a/extlib/fs/legacy/directory-open.mjs
+++ /dev/null
@@ -1,58 +0,0 @@
-/**
- * Copyright 2020 Google LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-// @license © 2020 Google LLC. Licensed under the Apache License, Version 2.0.
-
-/**
- * Opens a directory from disk using the legacy
- * `` method.
- * @type { typeof import("../../index").directoryOpen }
- */
-export default async (options = {}) => {
- options.recursive = options.recursive || false;
- return new Promise((resolve, reject) => {
- const input = document.createElement('input');
- input.type = 'file';
- input.webkitdirectory = true;
-
- // ToDo: Remove this workaround once
- // https://github.com/whatwg/html/issues/6376 is specified and supported.
- const rejectOnPageInteraction = () => {
- window.removeEventListener('pointermove', rejectOnPageInteraction);
- window.removeEventListener('pointerdown', rejectOnPageInteraction);
- window.removeEventListener('keydown', rejectOnPageInteraction);
- reject(new DOMException('The user aborted a request.', 'AbortError'));
- };
-
- window.addEventListener('pointermove', rejectOnPageInteraction);
- window.addEventListener('pointerdown', rejectOnPageInteraction);
- window.addEventListener('keydown', rejectOnPageInteraction);
-
- input.addEventListener('change', () => {
- window.removeEventListener('pointermove', rejectOnPageInteraction);
- window.removeEventListener('pointerdown', rejectOnPageInteraction);
- window.removeEventListener('keydown', rejectOnPageInteraction);
- let files = Array.from(input.files);
- if (!options.recursive) {
- files = files.filter((file) => {
- return file.webkitRelativePath.split('/').length === 2;
- });
- }
- resolve(files);
- });
-
- input.click();
- });
-};
diff --git a/extlib/fs/legacy/file-open.mjs b/extlib/fs/legacy/file-open.mjs
deleted file mode 100644
index cfa4f7f..0000000
--- a/extlib/fs/legacy/file-open.mjs
+++ /dev/null
@@ -1,56 +0,0 @@
-/**
- * Copyright 2020 Google LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-// @license © 2020 Google LLC. Licensed under the Apache License, Version 2.0.
-
-/**
- * Opens a file from disk using the legacy `` method.
- * @type { typeof import("../../index").fileOpen }
- */
-export default async (options = {}) => {
- return new Promise((resolve, reject) => {
- const input = document.createElement('input');
- input.type = 'file';
- const accept = [
- ...(options.mimeTypes ? options.mimeTypes : []),
- options.extensions ? options.extensions : [],
- ].join();
- input.multiple = options.multiple || false;
- // Empty string allows everything.
- input.accept = accept || '';
-
- // ToDo: Remove this workaround once
- // https://github.com/whatwg/html/issues/6376 is specified and supported.
- const rejectOnPageInteraction = () => {
- window.removeEventListener('pointermove', rejectOnPageInteraction);
- window.removeEventListener('pointerdown', rejectOnPageInteraction);
- window.removeEventListener('keydown', rejectOnPageInteraction);
- reject(new DOMException('The user aborted a request.', 'AbortError'));
- };
-
- window.addEventListener('pointermove', rejectOnPageInteraction);
- window.addEventListener('pointerdown', rejectOnPageInteraction);
- window.addEventListener('keydown', rejectOnPageInteraction);
-
- input.addEventListener('change', () => {
- window.removeEventListener('pointermove', rejectOnPageInteraction);
- window.removeEventListener('pointerdown', rejectOnPageInteraction);
- window.removeEventListener('keydown', rejectOnPageInteraction);
- resolve(input.multiple ? input.files : input.files[0]);
- });
-
- input.click();
- });
-};
diff --git a/extlib/fs/legacy/file-save.mjs b/extlib/fs/legacy/file-save.mjs
deleted file mode 100644
index da453f7..0000000
--- a/extlib/fs/legacy/file-save.mjs
+++ /dev/null
@@ -1,32 +0,0 @@
-/**
- * Copyright 2020 Google LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-// @license © 2020 Google LLC. Licensed under the Apache License, Version 2.0.
-
-/**
- * Saves a file to disk using the legacy `` method.
- * @type { typeof import("../../index").fileSave }
- */
-export default async (blob, options = {}) => {
- const a = document.createElement('a');
- a.download = options.fileName || 'Untitled';
- a.href = URL.createObjectURL(blob);
- a.addEventListener('click', () => {
- // `setTimeout()` due to
- // https://github.com/LLK/scratch-gui/issues/1783#issuecomment-426286393
- setTimeout(() => URL.revokeObjectURL(a.href), 30 * 1000);
- });
- a.click();
-};
diff --git a/extlib/fs/supported.mjs b/extlib/fs/supported.mjs
deleted file mode 100644
index b1ac42a..0000000
--- a/extlib/fs/supported.mjs
+++ /dev/null
@@ -1,43 +0,0 @@
-/**
- * Copyright 2020 Google LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-// @license © 2020 Google LLC. Licensed under the Apache License, Version 2.0.
-
-/**
- * Returns whether the File System Access API is supported and usable in the
- * current context (for example cross-origin iframes).
- * @returns {boolean} Returns `true` if the File System Access API is supported and usable, else returns `false`.
- */
-const supported = (() => {
- // ToDo: Remove this check once Permissions Policy integration
- // has happened, tracked in
- // https://github.com/WICG/file-system-access/issues/245.
- if ('top' in self && self !== top) {
- try {
- // This will succeed on same-origin iframes,
- // but fail on cross-origin iframes.
- top.location + '';
- } catch {
- return false;
- }
- } else if ('chooseFileSystemEntries' in self) {
- return 'chooseFileSystemEntries';
- } else if ('showOpenFilePicker' in self) {
- return 'showOpenFilePicker';
- }
- return false;
-})();
-
-export default supported;
diff --git a/icon/svgr_raw/coincident_alt.svg b/icon/svgr_raw/coincident_alt.svg
deleted file mode 100644
index d89c510..0000000
--- a/icon/svgr_raw/coincident_alt.svg
+++ /dev/null
@@ -1,135 +0,0 @@
-
-
diff --git a/src/Sketch.js b/src/Sketch.js
index bcb1c12..c9d7ec4 100644
--- a/src/Sketch.js
+++ b/src/Sketch.js
@@ -235,8 +235,8 @@ class Sketch {
onKeyPress(e) {
if (e.isTrusted && e.key == 'Escape') {
+ this.disableLineHover = false
drawClear.call(this)
- document.activeElement.blur()
this.scene.store.dispatch({ type: 'set-mode', mode: '' })
} else {
@@ -249,19 +249,18 @@ class Sketch {
v: 'vertical',
h: 'horizontal',
t: 'tangent',
- 'Delete': 'delete',
- 'Backspace': 'delete'
+ Delete: 'delete',
+ Backspace: 'delete'
}
this.command(keyToMode[e.key])
- console.log(e.key)
}
}
command(com) {
+ this.disableLineHover = false
drawClear.call(this)
- document.activeElement.blur()
let mode;
@@ -273,6 +272,7 @@ class Sketch {
case 'vertical':
case 'horizontal':
case 'tangent':
+ // need to fire synthetic event to clear any earlier awaitSelection (see shared.js)
window.dispatchEvent(new KeyboardEvent('keydown', { key: 'Escape' }));
case 'line':
case 'arc':
@@ -286,9 +286,11 @@ class Sketch {
switch (com) {
case 'line':
case 'arc':
+ this.disableLineHover = true
this.canvas.addEventListener('pointerdown', this.drawOnClick1, { once: true });
break;
case 'point':
+ this.disableLineHover = true
this.canvas.addEventListener('pointerdown', (e) => {
if (this.scene.mode !== 'point') return
const pt = ptObj()
diff --git a/src/drawEvents.js b/src/drawEvents.js
index dbff600..0005c0d 100644
--- a/src/drawEvents.js
+++ b/src/drawEvents.js
@@ -136,7 +136,6 @@ export function drawOnClick2(e) {
let ccw;
export function drawPreClick3(e) {
- this.noHover = true
const mouseLoc = this.getLocation(e);
ccw = drawArc4(mouseLoc, this.toPush)
this.scene.render()
@@ -144,7 +143,6 @@ export function drawPreClick3(e) {
export function drawOnClick3(e) {
if (e.buttons !== 1) return;
- this.noHover = false
this.canvas.removeEventListener('pointermove', this.drawPreClick3);
if (!ccw) {
diff --git a/src/mouseEvents.js b/src/mouseEvents.js
index e3e9eb9..c691b92 100644
--- a/src/mouseEvents.js
+++ b/src/mouseEvents.js
@@ -5,7 +5,7 @@ import { onDimMoveEnd } from './drawDimension'
let ptLoc
export function onHover(e) {
- if (e.buttons || this.noHover) return
+ if (e.buttons) return
raycaster.setFromCamera(
new THREE.Vector2(
@@ -45,7 +45,7 @@ export function onHover(e) {
}
}
- if (!idx.length) {
+ if (!idx.length && !this.disableLineHover) {
idx.push(0)
}
diff --git a/src/react/fileHelpers.js b/src/react/fileHelpers.js
index 4511190..d2792d1 100644
--- a/src/react/fileHelpers.js
+++ b/src/react/fileHelpers.js
@@ -1,14 +1,14 @@
-import {
- fileOpen,
- fileSave,
-} from '../../extlib/fs/index';
-
// import {
// fileOpen,
// fileSave,
-// } from 'browser-fs-access';
+// } from '../../extlib/fs/index';
+
+import {
+ fileOpen,
+ fileSave,
+} from 'browser-fs-access';
import { sce } from './app'
diff --git a/src/react/navBar.jsx b/src/react/navBar.jsx
index 9ab3897..57ed0a9 100644
--- a/src/react/navBar.jsx
+++ b/src/react/navBar.jsx
@@ -78,7 +78,6 @@ export const NavBar = () => {
sketch.activate()
sce.render()
- console.log(sketch)
dispatch({ type: 'set-dialog', action: 'sketch', target: sketch.obj3d.name })
@@ -128,7 +127,7 @@ export const NavBar = () => {
[Icon.Line, () => sce.activeSketch.command('line'), 'Line (L)'], //1
[Icon.Arc, () => sce.activeSketch.command('arc'), 'Arc (A)'],
[Icon.Dimension, () => sce.activeSketch.command('dimension'), 'Dimension (D)'],
- [Icon.Coincident_alt, () => sce.activeSketch.command('coincident'), 'Coincident (C)'],
+ [Icon.Coincident, () => sce.activeSketch.command('coincident'), 'Coincident (C)'],
[Icon.Vertical, () => sce.activeSketch.command('vertical'), 'Vertical (V)'],
[Icon.Horizontal, () => sce.activeSketch.command('horizontal'), 'Horizontal (H)'],
[Icon.Tangent, () => sce.activeSketch.command('tangent'), 'Tangent (T)'], //7
diff --git a/src/react/reducer.js b/src/react/reducer.js
index 40b20c4..3a445bb 100644
--- a/src/react/reducer.js
+++ b/src/react/reducer.js
@@ -114,9 +114,6 @@ const defaultUIState = {
export function ui(state = defaultUIState, action) {
switch (action.type) {
case 'set-active-sketch':
- return update(state, {
- sketchActive: { $set: true },
- })
case 'rx-sketch':
return update(state, {
sketchActive: { $set: true },
@@ -147,9 +144,6 @@ export function ui(state = defaultUIState, action) {
modified: { $set: action.status },
})
case 'delete-node':
- return update(state, {
- modified: { $set: true },
- })
case 'rx-extrusion':
return update(state, {
modified: { $set: true },
@@ -160,7 +154,6 @@ export function ui(state = defaultUIState, action) {
})
case 'on-pick':
- console.log(action.obj.userData.type)
const idx = state.selectedList.indexOf(action.obj)
const setNeedsUpdate = action.obj.userData.type == 'mesh' || action.obj.userData.type == 'sketch'