regenerate seed on change of sloppiness (#1986)

This commit is contained in:
David Luzar 2020-07-30 20:14:38 +02:00 committed by GitHub
parent 818821c293
commit fea257765d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 11 deletions

View File

@ -21,6 +21,7 @@ import { t } from "../i18n";
import { register } from "./register";
import { newElementWith } from "../element/mutateElement";
import { DEFAULT_FONT_SIZE, DEFAULT_FONT_FAMILY } from "../constants";
import { randomInteger } from "../random";
const changeProperty = (
elements: readonly ExcalidrawElement[],
@ -199,6 +200,7 @@ export const actionChangeSloppiness = register({
return {
elements: changeProperty(elements, appState, (el) =>
newElementWith(el, {
seed: randomInteger(),
roughness: value,
}),
),

View File

@ -7,7 +7,7 @@ import { Point } from "../types";
type ElementUpdate<TElement extends ExcalidrawElement> = Omit<
Partial<TElement>,
"id" | "seed" | "version" | "versionNonce"
"id" | "version" | "versionNonce"
>;
// This function tracks updates of text elements for the purposes for collaboration.

View File

@ -16736,7 +16736,7 @@ Object {
"strokeWidth": 2,
"type": "rectangle",
"version": 3,
"versionNonce": 915032327,
"versionNonce": 81784553,
"width": 20,
"x": 10,
"y": 10,
@ -16754,13 +16754,13 @@ Object {
"isDeleted": false,
"opacity": 60,
"roughness": 2,
"seed": 449462985,
"seed": 23633383,
"strokeColor": "#c92a2a",
"strokeStyle": "dotted",
"strokeWidth": 2,
"type": "rectangle",
"version": 13,
"versionNonce": 493213705,
"versionNonce": 915032327,
"width": 20,
"x": 40,
"y": 40,
@ -17288,13 +17288,13 @@ Object {
"isDeleted": false,
"opacity": 100,
"roughness": 2,
"seed": 449462985,
"seed": 23633383,
"strokeColor": "#c92a2a",
"strokeStyle": "dotted",
"strokeWidth": 2,
"type": "rectangle",
"version": 12,
"versionNonce": 23633383,
"versionNonce": 493213705,
"width": 20,
"x": 40,
"y": 40,
@ -17343,13 +17343,13 @@ Object {
"isDeleted": false,
"opacity": 60,
"roughness": 2,
"seed": 449462985,
"seed": 23633383,
"strokeColor": "#c92a2a",
"strokeStyle": "dotted",
"strokeWidth": 2,
"type": "rectangle",
"version": 13,
"versionNonce": 493213705,
"versionNonce": 915032327,
"width": 20,
"x": 40,
"y": 40,
@ -17383,7 +17383,7 @@ Object {
"strokeWidth": 2,
"type": "rectangle",
"version": 3,
"versionNonce": 915032327,
"versionNonce": 81784553,
"width": 20,
"x": 10,
"y": 10,
@ -17398,13 +17398,13 @@ Object {
"isDeleted": false,
"opacity": 60,
"roughness": 2,
"seed": 449462985,
"seed": 23633383,
"strokeColor": "#c92a2a",
"strokeStyle": "dotted",
"strokeWidth": 2,
"type": "rectangle",
"version": 13,
"versionNonce": 493213705,
"versionNonce": 915032327,
"width": 20,
"x": 40,
"y": 40,