From 9ac2179697765eade925c9a30bab2d96b19b2e98 Mon Sep 17 00:00:00 2001 From: Hans Pagel Date: Mon, 11 Jan 2021 15:30:43 +0100 Subject: [PATCH] improve the drawing example --- docs/src/components/Demo/style.scss | 3 +++ docs/src/demos/Examples/Drawing/Component.vue | 18 +++++++++++++++--- docs/src/docPages/examples/drawing.md | 11 ++++++++++- docs/src/links.yaml | 2 -- 4 files changed, 28 insertions(+), 6 deletions(-) diff --git a/docs/src/components/Demo/style.scss b/docs/src/components/Demo/style.scss index 4c6e6d3d..6ef8cee8 100644 --- a/docs/src/components/Demo/style.scss +++ b/docs/src/components/Demo/style.scss @@ -9,6 +9,9 @@ border-bottom-width: 0; color: $colorBlack; background-color: $colorWhite; + max-height: 50rem; + overflow: auto; + scroll-behavior: smooth; } &__source { diff --git a/docs/src/demos/Examples/Drawing/Component.vue b/docs/src/demos/Examples/Drawing/Component.vue index 3d426471..4d1cd508 100644 --- a/docs/src/demos/Examples/Drawing/Component.vue +++ b/docs/src/demos/Examples/Drawing/Component.vue @@ -30,6 +30,10 @@ import { v4 as uuid } from 'uuid' import * as d3 from 'd3' import simplify from 'simplify-js' +const getRandomElement = list => { + return list[Math.floor(Math.random() * list.length)] +} + export default { name: 'Paper', @@ -47,8 +51,16 @@ export default { data() { return { - color: '#000000', - size: 2, + color: getRandomElement([ + '#A975FF', + '#FB5151', + '#FD9170', + '#FFCB6B', + '#68CEF8', + '#80CBC4', + '#9DEF8F', + ]), + size: Math.floor(Math.random() * Math.floor(20)), svg: null, path: null, points: [], @@ -148,7 +160,7 @@ export default {