@onesy/ui-react 1.0.163 → 1.0.165
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Accordion/Accordion.d.ts +2 -2
- package/Accordion/Accordion.js +18 -41
- package/AdvancedTextField/AdvancedTextField.d.ts +1 -1
- package/AdvancedTextField/AdvancedTextField.js +17 -22
- package/Append/Append.d.ts +3 -3
- package/Append/Append.js +98 -110
- package/AreaChart/AreaChart.d.ts +1 -1
- package/AreaChart/AreaChart.js +27 -18
- package/AreaChartItem/AreaChartItem.d.ts +1 -1
- package/AreaChartItem/AreaChartItem.js +38 -49
- package/AudioPlayer/AudioPlayer.d.ts +1 -1
- package/AudioPlayer/AudioPlayer.js +89 -116
- package/AudioRecorder/AudioRecorder.d.ts +1 -1
- package/AudioRecorder/AudioRecorder.js +24 -42
- package/AutoComplete/AutoComplete.d.ts +3 -3
- package/AutoComplete/AutoComplete.js +119 -151
- package/AutoCompleteCountry/AutoCompleteCountry.d.ts +1 -1
- package/AutoCompleteCountry/AutoCompleteCountry.js +11 -22
- package/AutoCompleteCurrency/AutoCompleteCurrency.d.ts +1 -1
- package/AutoCompleteCurrency/AutoCompleteCurrency.js +4 -9
- package/Avatar/Avatar.d.ts +1 -1
- package/Avatar/Avatar.js +58 -31
- package/AvatarGroup/AvatarGroup.d.ts +1 -1
- package/AvatarGroup/AvatarGroup.js +40 -23
- package/Backdrop/Backdrop.d.ts +1 -1
- package/Backdrop/Backdrop.js +7 -18
- package/Badge/Badge.d.ts +1 -1
- package/Badge/Badge.js +53 -26
- package/Banner/Banner.d.ts +1 -1
- package/Banner/Banner.js +86 -39
- package/BottomAppBar/BottomAppBar.d.ts +1 -1
- package/BottomAppBar/BottomAppBar.js +61 -31
- package/BottomSheet/BottomSheet.d.ts +1 -1
- package/BottomSheet/BottomSheet.js +23 -13
- package/Box/Box.d.ts +1 -1
- package/Box/Box.js +25 -11
- package/Breadcrumbs/Breadcrumbs.d.ts +1 -1
- package/Breadcrumbs/Breadcrumbs.js +27 -38
- package/BubbleChart/BubbleChart.d.ts +1 -1
- package/BubbleChart/BubbleChart.js +126 -120
- package/BubbleChartItem/BubbleChartItem.d.ts +1 -1
- package/BubbleChartItem/BubbleChartItem.js +12 -23
- package/Button/Button.d.ts +1 -1
- package/Button/Button.js +27 -42
- package/Buttons/Buttons.d.ts +1 -1
- package/Buttons/Buttons.js +208 -97
- package/Calendar/Calendar.d.ts +3 -3
- package/Calendar/Calendar.js +95 -133
- package/CalendarAvailability/CalendarAvailability.d.ts +2 -2
- package/CalendarAvailability/CalendarAvailability.js +107 -148
- package/CalendarMenu/CalendarMenu.d.ts +1 -1
- package/CalendarMenu/CalendarMenu.js +47 -80
- package/CalendarMonth/CalendarMonth.d.ts +5 -5
- package/CalendarMonth/CalendarMonth.js +103 -124
- package/CalendarViews/CalendarViews.d.ts +2 -2
- package/CalendarViews/CalendarViews.js +34 -60
- package/CalendarWeek/CalendarWeek.d.ts +1 -1
- package/CalendarWeek/CalendarWeek.js +84 -95
- package/Card/Card.d.ts +1 -1
- package/Card/Card.js +10 -21
- package/CardButton/CardButton.d.ts +1 -1
- package/CardButton/CardButton.js +8 -13
- package/CardFooter/CardFooter.d.ts +1 -1
- package/CardFooter/CardFooter.js +40 -21
- package/CardHeader/CardHeader.d.ts +1 -1
- package/CardHeader/CardHeader.js +68 -24
- package/CardImage/CardImage.d.ts +1 -1
- package/CardImage/CardImage.js +31 -13
- package/CardMain/CardMain.d.ts +1 -1
- package/CardMain/CardMain.js +30 -16
- package/Carousel/Carousel.d.ts +4 -4
- package/Carousel/Carousel.js +163 -181
- package/Chart/Chart.d.ts +4 -4
- package/Chart/Chart.js +250 -271
- package/Checkbox/Checkbox.d.ts +1 -1
- package/Checkbox/Checkbox.js +137 -33
- package/Chip/Chip.d.ts +1 -1
- package/Chip/Chip.js +5 -10
- package/Chips/Chips.d.ts +1 -1
- package/Chips/Chips.js +73 -38
- package/ClickListener/ClickListener.d.ts +1 -1
- package/ClickListener/ClickListener.js +10 -12
- package/Clock/Clock.d.ts +5 -5
- package/Clock/Clock.js +81 -89
- package/ColorTextField/ColorTextField.d.ts +1 -1
- package/ColorTextField/ColorTextField.js +190 -75
- package/ColumnChart/ColumnChart.d.ts +1 -1
- package/ColumnChart/ColumnChart.js +43 -24
- package/ColumnChartItem/ColumnChartItem.d.ts +1 -1
- package/ColumnChartItem/ColumnChartItem.js +12 -23
- package/Confirm/Confirm.d.ts +4 -4
- package/Confirm/Confirm.js +13 -37
- package/Container/Container.d.ts +1 -1
- package/Container/Container.js +9 -14
- package/CookieBanner/CookieBanner.d.ts +1 -1
- package/CookieBanner/CookieBanner.js +65 -39
- package/Countdown/Countdown.d.ts +1 -1
- package/Countdown/Countdown.js +25 -54
- package/DatePicker/DatePicker.d.ts +1 -1
- package/DatePicker/DatePicker.js +138 -176
- package/DateRangePicker/DateRangePicker.d.ts +1 -1
- package/DateRangePicker/DateRangePicker.js +23 -13
- package/DateTimePicker/DateTimePicker.d.ts +2 -2
- package/DateTimePicker/DateTimePicker.js +118 -156
- package/DateTimeRangePicker/DateTimeRangePicker.d.ts +1 -1
- package/DateTimeRangePicker/DateTimeRangePicker.js +23 -13
- package/Divider/Divider.d.ts +1 -1
- package/Divider/Divider.js +4 -12
- package/DonutChart/DonutChart.d.ts +1 -1
- package/DonutChart/DonutChart.js +23 -13
- package/DragAndDropList/DragAndDropList.d.ts +1 -1
- package/DragAndDropList/DragAndDropList.js +31 -33
- package/Drawing/Drawing.d.ts +2 -2
- package/Drawing/Drawing.js +107 -153
- package/DropZone/DropZone.d.ts +1 -1
- package/DropZone/DropZone.js +36 -54
- package/Emojis/Emojis.d.ts +3 -3
- package/Emojis/Emojis.js +52 -84
- package/Expand/Expand.d.ts +1 -1
- package/Expand/Expand.js +70 -37
- package/Fab/Fab.d.ts +1 -1
- package/Fab/Fab.js +8 -11
- package/Fade/Fade.d.ts +1 -1
- package/Fade/Fade.js +221 -111
- package/FileChoose/FileChoose.d.ts +2 -2
- package/FileChoose/FileChoose.js +26 -43
- package/Focus/Focus.d.ts +1 -1
- package/Focus/Focus.js +8 -10
- package/Form/Form.d.ts +1 -1
- package/Form/Form.js +95 -54
- package/FormRow/FormRow.d.ts +1 -1
- package/FormRow/FormRow.js +89 -42
- package/Forms/Forms.d.ts +1 -1
- package/Forms/Forms.js +36 -19
- package/Frame/Frame.d.ts +1 -1
- package/Frame/Frame.js +8 -22
- package/Grid/Grid.d.ts +2 -2
- package/Grid/Grid.js +13 -18
- package/Grow/Grow.d.ts +1 -1
- package/Grow/Grow.js +233 -118
- package/HTMLCanvas/HTMLCanvas.d.ts +2 -2
- package/HTMLCanvas/HTMLCanvas.js +225 -254
- package/IFrame/IFrame.d.ts +1 -1
- package/IFrame/IFrame.js +5 -11
- package/Icon/Icon.d.ts +1 -1
- package/Icon/Icon.js +82 -42
- package/IconButton/IconButton.d.ts +1 -1
- package/IconButton/IconButton.js +31 -18
- package/Image/Image.d.ts +1 -1
- package/Image/Image.js +13 -24
- package/ImageCrop/ImageCrop.d.ts +2 -2
- package/ImageCrop/ImageCrop.js +238 -244
- package/ImageEdit/ImageEdit.d.ts +2 -2
- package/ImageEdit/ImageEdit.js +189 -225
- package/ImageGallery/ImageGallery.d.ts +1 -1
- package/ImageGallery/ImageGallery.js +55 -73
- package/ImageList/ImageList.d.ts +1 -1
- package/ImageList/ImageList.js +13 -15
- package/ImageListItem/ImageListItem.d.ts +1 -1
- package/ImageListItem/ImageListItem.js +9 -14
- package/ImageListItemBox/ImageListItemBox.d.ts +1 -1
- package/ImageListItemBox/ImageListItemBox.js +30 -16
- package/Info/Info.d.ts +1 -1
- package/Info/Info.js +83 -42
- package/Interaction/Interaction.d.ts +2 -2
- package/Interaction/Interaction.js +39 -41
- package/Keyframes/Keyframes.d.ts +3 -3
- package/Keyframes/Keyframes.js +16 -18
- package/Keyframes/useKeyframes.js +1 -1
- package/Label/Label.d.ts +1 -1
- package/Label/Label.js +6 -15
- package/Labels/Labels.d.ts +1 -1
- package/Labels/Labels.js +16 -24
- package/Line/Line.d.ts +6 -6
- package/Line/Line.js +10 -15
- package/LineChart/LineChart.d.ts +1 -1
- package/LineChart/LineChart.js +27 -18
- package/LineChartItem/LineChartItem.d.ts +1 -1
- package/LineChartItem/LineChartItem.js +22 -33
- package/LinearMeter/LinearMeter.d.ts +1 -1
- package/LinearMeter/LinearMeter.js +125 -130
- package/LinearProgress/LinearProgress.d.ts +1 -1
- package/LinearProgress/LinearProgress.js +51 -31
- package/Link/Link.d.ts +1 -1
- package/Link/Link.js +59 -27
- package/Links/Links.d.ts +2 -2
- package/Links/Links.js +110 -81
- package/List/List.d.ts +1 -1
- package/List/List.js +12 -20
- package/ListItem/ListItem.d.ts +1 -1
- package/ListItem/ListItem.js +5 -17
- package/ListSubheader/ListSubheader.d.ts +1 -1
- package/ListSubheader/ListSubheader.js +23 -13
- package/MainProgress/MainProgress.d.ts +1 -1
- package/MainProgress/MainProgress.js +7 -12
- package/MainProgressMaterial/MainProgressMaterial.d.ts +3 -3
- package/MainProgressMaterial/MainProgressMaterial.js +15 -23
- package/Markdown/Markdown.d.ts +1 -1
- package/Markdown/Markdown.js +192 -194
- package/Masonry/Masonry.d.ts +1 -1
- package/Masonry/Masonry.js +25 -30
- package/Medias/Medias.d.ts +3 -3
- package/Medias/Medias.js +86 -113
- package/Menu/Menu.d.ts +1 -1
- package/Menu/Menu.js +55 -66
- package/MenuDesktop/MenuDesktop.d.ts +3 -3
- package/MenuDesktop/MenuDesktop.js +118 -121
- package/MenuItem/MenuItem.d.ts +1 -1
- package/MenuItem/MenuItem.js +40 -60
- package/Meta/Meta.d.ts +1 -1
- package/Meta/Meta.js +57 -35
- package/Modal/Modal.d.ts +1 -1
- package/Modal/Modal.js +11 -25
- package/ModalFooter/ModalFooter.d.ts +1 -1
- package/ModalFooter/ModalFooter.js +30 -16
- package/ModalHeader/ModalHeader.d.ts +1 -1
- package/ModalHeader/ModalHeader.js +32 -17
- package/ModalIcon/ModalIcon.d.ts +1 -1
- package/ModalIcon/ModalIcon.js +2 -4
- package/ModalMain/ModalMain.d.ts +1 -1
- package/ModalMain/ModalMain.js +31 -17
- package/ModalText/ModalText.d.ts +1 -1
- package/ModalText/ModalText.js +28 -15
- package/ModalTitle/ModalTitle.d.ts +1 -1
- package/ModalTitle/ModalTitle.js +28 -15
- package/MoreOptions/MoreOptions.d.ts +1 -1
- package/MoreOptions/MoreOptions.js +43 -28
- package/Move/Move.d.ts +1 -1
- package/Move/Move.js +24 -26
- package/NavigationBar/NavigationBar.d.ts +2 -2
- package/NavigationBar/NavigationBar.js +64 -39
- package/NavigationDrawer/NavigationDrawer.d.ts +1 -1
- package/NavigationDrawer/NavigationDrawer.js +12 -21
- package/NavigationItem/NavigationItem.d.ts +2 -2
- package/NavigationItem/NavigationItem.js +26 -41
- package/NavigationRail/NavigationRail.d.ts +1 -1
- package/NavigationRail/NavigationRail.js +69 -54
- package/NotFound/NotFound.d.ts +1 -1
- package/NotFound/NotFound.js +7 -18
- package/NumericTextField/NumericTextField.d.ts +1 -1
- package/NumericTextField/NumericTextField.js +51 -59
- package/Page/Page.d.ts +2 -2
- package/Page/Page.js +6 -20
- package/PageTransition/PageTransition.d.ts +1 -1
- package/PageTransition/PageTransition.js +7 -12
- package/Pagination/Pagination.d.ts +1 -1
- package/Pagination/Pagination.js +121 -68
- package/PaginationItem/PaginationItem.d.ts +1 -1
- package/PaginationItem/PaginationItem.js +50 -30
- package/Parallax/Parallax.d.ts +2 -2
- package/Parallax/Parallax.js +9 -11
- package/Path/Path.d.ts +1 -1
- package/Path/Path.js +22 -9
- package/PieChart/PieChart.d.ts +1 -1
- package/PieChart/PieChart.js +38 -55
- package/Placeholder/Placeholder.d.ts +1 -1
- package/Placeholder/Placeholder.js +59 -23
- package/Portal/Portal.d.ts +1 -1
- package/Portal/Portal.js +2 -4
- package/Properties/Properties.d.ts +2 -2
- package/Properties/Properties.js +51 -30
- package/Property/Property.d.ts +1 -1
- package/Property/Property.js +4 -12
- package/Radio/Radio.d.ts +1 -1
- package/Radio/Radio.js +83 -24
- package/Radios/Radios.d.ts +1 -1
- package/Radios/Radios.js +6 -14
- package/Rating/Rating.d.ts +1 -1
- package/Rating/Rating.js +68 -71
- package/Reset/Reset.d.ts +1 -1
- package/Reset/Reset.js +26 -4
- package/Reveal/Reveal.d.ts +1 -1
- package/Reveal/Reveal.js +8 -14
- package/RichTextEditor/RichTextEditor.d.ts +1 -1
- package/RichTextEditor/RichTextEditor.js +194 -254
- package/RoundMeter/RoundMeter.d.ts +1 -1
- package/RoundMeter/RoundMeter.js +207 -212
- package/RoundProgress/RoundProgress.d.ts +1 -1
- package/RoundProgress/RoundProgress.js +46 -27
- package/ScatterChart/ScatterChart.d.ts +1 -1
- package/ScatterChart/ScatterChart.js +27 -18
- package/ScatterChartItem/ScatterChartItem.d.ts +1 -1
- package/ScatterChartItem/ScatterChartItem.js +15 -26
- package/ScreenCapture/ScreenCapture.d.ts +2 -2
- package/ScreenCapture/ScreenCapture.js +57 -81
- package/Section/Section.d.ts +2 -2
- package/Section/Section.js +13 -24
- package/SectionAction/SectionAction.d.ts +1 -1
- package/SectionAction/SectionAction.js +4 -12
- package/SectionBoxes/SectionBoxes.d.ts +2 -2
- package/SectionBoxes/SectionBoxes.js +14 -28
- package/SectionCards/SectionCards.d.ts +2 -2
- package/SectionCards/SectionCards.js +14 -28
- package/SectionCarousel/SectionCarousel.d.ts +2 -2
- package/SectionCarousel/SectionCarousel.js +15 -32
- package/SectionContact/SectionContact.d.ts +1 -1
- package/SectionContact/SectionContact.js +6 -20
- package/SectionImageGallery/SectionImageGallery.d.ts +1 -1
- package/SectionImageGallery/SectionImageGallery.js +4 -12
- package/SectionLogos/SectionLogos.d.ts +1 -1
- package/SectionLogos/SectionLogos.js +8 -19
- package/SectionMedia/SectionMedia.d.ts +1 -1
- package/SectionMedia/SectionMedia.js +11 -34
- package/SectionReviews/SectionReviews.d.ts +2 -2
- package/SectionReviews/SectionReviews.js +16 -33
- package/SectionTextMedia/SectionTextMedia.d.ts +1 -1
- package/SectionTextMedia/SectionTextMedia.js +10 -37
- package/SectionTimeline/SectionTimeline.d.ts +2 -2
- package/SectionTimeline/SectionTimeline.js +17 -34
- package/SectionWatch/SectionWatch.d.ts +1 -1
- package/SectionWatch/SectionWatch.js +4 -12
- package/Select/Select.d.ts +1 -1
- package/Select/Select.js +95 -121
- package/Share/Share.d.ts +1 -1
- package/Share/Share.js +217 -119
- package/Slide/Slide.d.ts +1 -1
- package/Slide/Slide.js +16 -18
- package/Slider/Slider.d.ts +2 -2
- package/Slider/Slider.js +150 -165
- package/SmartTextField/SmartTextField.d.ts +1 -1
- package/SmartTextField/SmartTextField.js +203 -256
- package/Snackbar/Snackbar.d.ts +1 -1
- package/Snackbar/Snackbar.js +18 -35
- package/Snackbars/Context.d.ts +1 -1
- package/Snackbars/Snackbars.d.ts +2 -2
- package/Snackbars/Snackbars.js +43 -57
- package/Space/Space.d.ts +1 -1
- package/Space/Space.js +762 -556
- package/SpeechToText/SpeechToText.d.ts +1 -1
- package/SpeechToText/SpeechToText.js +26 -37
- package/SpeedDial/SpeedDial.d.ts +1 -1
- package/SpeedDial/SpeedDial.js +69 -58
- package/SpeedDialItem/SpeedDialItem.d.ts +1 -1
- package/SpeedDialItem/SpeedDialItem.js +34 -23
- package/SpyScroll/SpyScroll.d.ts +1 -1
- package/SpyScroll/SpyScroll.js +17 -19
- package/Step/Step.d.ts +1 -1
- package/Step/Step.js +41 -52
- package/Stepper/Stepper.d.ts +1 -1
- package/Stepper/Stepper.js +12 -20
- package/Surface/Surface.d.ts +1 -1
- package/Surface/Surface.js +208 -133
- package/Switch/Switch.d.ts +1 -1
- package/Switch/Switch.js +107 -48
- package/Tab/Tab.d.ts +1 -1
- package/Tab/Tab.js +137 -68
- package/Table/Table.d.ts +1 -1
- package/Table/Table.js +70 -33
- package/TableBody/TableBody.d.ts +1 -1
- package/TableBody/TableBody.js +44 -23
- package/TableCell/TableCell.d.ts +2 -2
- package/TableCell/TableCell.js +26 -40
- package/TableFooter/TableFooter.d.ts +1 -1
- package/TableFooter/TableFooter.js +36 -19
- package/TableHead/TableHead.d.ts +1 -1
- package/TableHead/TableHead.js +15 -26
- package/TableHeader/TableHeader.d.ts +1 -1
- package/TableHeader/TableHeader.js +38 -23
- package/TablePagination/TablePagination.d.ts +1 -1
- package/TablePagination/TablePagination.js +10 -27
- package/TableRow/TableRow.d.ts +1 -1
- package/TableRow/TableRow.js +47 -26
- package/Tabs/Tabs.d.ts +1 -1
- package/Tabs/Tabs.js +41 -56
- package/Text/Text.d.ts +1 -1
- package/Text/Text.js +10 -18
- package/TextField/TextField.d.ts +1 -1
- package/TextField/TextField.js +68 -83
- package/TextToSpeech/TextToSpeech.d.ts +1 -1
- package/TextToSpeech/TextToSpeech.js +21 -32
- package/TimePicker/TimePicker.d.ts +3 -3
- package/TimePicker/TimePicker.js +183 -230
- package/TimeRangePicker/TimeRangePicker.d.ts +1 -1
- package/TimeRangePicker/TimeRangePicker.js +23 -13
- package/Timeline/Timeline.d.ts +1 -1
- package/Timeline/Timeline.js +35 -19
- package/TimelineItem/TimelineItem.d.ts +1 -1
- package/TimelineItem/TimelineItem.js +5 -16
- package/Timer/Timer.d.ts +1 -1
- package/Timer/Timer.js +29 -55
- package/ToggleButton/ToggleButton.d.ts +1 -1
- package/ToggleButton/ToggleButton.js +29 -16
- package/ToggleButtons/ToggleButtons.d.ts +1 -1
- package/ToggleButtons/ToggleButtons.js +24 -15
- package/Tooltip/Tooltip.d.ts +1 -1
- package/Tooltip/Tooltip.js +46 -60
- package/TopAppBar/TopAppBar.d.ts +1 -1
- package/TopAppBar/TopAppBar.js +118 -61
- package/Transition/Transition.d.ts +3 -3
- package/Transition/Transition.js +54 -56
- package/Transition/useTransition.js +1 -1
- package/Transitions/Transitions.d.ts +2 -2
- package/Transitions/Transitions.js +10 -12
- package/Tree/Tree.d.ts +1 -1
- package/Tree/Tree.js +37 -60
- package/Type/Type.d.ts +1 -1
- package/Type/Type.js +24 -17
- package/VideoPlayer/VideoPlayer.d.ts +1 -1
- package/VideoPlayer/VideoPlayer.js +123 -150
- package/ViewSplit/ViewSplit.d.ts +1 -1
- package/ViewSplit/ViewSplit.js +66 -77
- package/Watch/Watch.d.ts +1 -1
- package/Watch/Watch.js +14 -31
- package/Weather/Weather.d.ts +4 -4
- package/Weather/Weather.js +75 -47
- package/Whiteboard/Whiteboard.d.ts +5 -5
- package/Whiteboard/Whiteboard.js +565 -570
- package/Widgets/Widgets.d.ts +2 -2
- package/Widgets/Widgets.js +31 -48
- package/WindowSplit/WindowSplit.d.ts +1 -1
- package/WindowSplit/WindowSplit.js +52 -63
- package/Zoom/Zoom.d.ts +1 -1
- package/Zoom/Zoom.js +221 -107
- package/esm/Accordion/Accordion.js +17 -17
- package/esm/AdvancedTextField/AdvancedTextField.js +16 -16
- package/esm/Append/Append.js +97 -103
- package/esm/AreaChart/AreaChart.js +26 -9
- package/esm/AreaChartItem/AreaChartItem.js +37 -37
- package/esm/AudioPlayer/AudioPlayer.js +88 -88
- package/esm/AudioRecorder/AudioRecorder.js +23 -23
- package/esm/AutoComplete/AutoComplete.js +115 -115
- package/esm/AutoCompleteCountry/AutoCompleteCountry.js +10 -10
- package/esm/AutoCompleteCurrency/AutoCompleteCurrency.js +3 -3
- package/esm/Avatar/Avatar.js +57 -22
- package/esm/AvatarGroup/AvatarGroup.js +39 -14
- package/esm/Backdrop/Backdrop.js +6 -6
- package/esm/Badge/Badge.js +52 -19
- package/esm/Banner/Banner.js +85 -27
- package/esm/BottomAppBar/BottomAppBar.js +60 -22
- package/esm/BottomSheet/BottomSheet.js +22 -7
- package/esm/Box/Box.js +24 -8
- package/esm/Breadcrumbs/Breadcrumbs.js +25 -25
- package/esm/BubbleChart/BubbleChart.js +130 -104
- package/esm/BubbleChartItem/BubbleChartItem.js +11 -11
- package/esm/Button/Button.js +25 -25
- package/esm/Buttons/Buttons.js +203 -86
- package/esm/Calendar/Calendar.js +93 -93
- package/esm/CalendarAvailability/CalendarAvailability.js +103 -103
- package/esm/CalendarMenu/CalendarMenu.js +46 -46
- package/esm/CalendarMonth/CalendarMonth.js +102 -102
- package/esm/CalendarViews/CalendarViews.js +33 -33
- package/esm/CalendarWeek/CalendarWeek.js +81 -81
- package/esm/Card/Card.js +9 -9
- package/esm/CardButton/CardButton.js +7 -7
- package/esm/CardFooter/CardFooter.js +39 -15
- package/esm/CardHeader/CardHeader.js +67 -18
- package/esm/CardImage/CardImage.js +30 -10
- package/esm/CardMain/CardMain.js +29 -10
- package/esm/Carousel/Carousel.js +162 -162
- package/esm/Chart/Chart.js +236 -236
- package/esm/Checkbox/Checkbox.js +136 -27
- package/esm/Chip/Chip.js +4 -4
- package/esm/Chips/Chips.js +72 -29
- package/esm/ClickListener/ClickListener.js +6 -6
- package/esm/Clock/Clock.js +80 -80
- package/esm/ColorTextField/ColorTextField.js +188 -57
- package/esm/ColumnChart/ColumnChart.js +42 -15
- package/esm/ColumnChartItem/ColumnChartItem.js +11 -11
- package/esm/Confirm/Confirm.js +12 -12
- package/esm/Container/Container.js +8 -8
- package/esm/CookieBanner/CookieBanner.js +64 -21
- package/esm/Countdown/Countdown.js +24 -24
- package/esm/DatePicker/DatePicker.js +136 -136
- package/esm/DateRangePicker/DateRangePicker.js +22 -7
- package/esm/DateTimePicker/DateTimePicker.js +116 -116
- package/esm/DateTimeRangePicker/DateTimeRangePicker.js +22 -7
- package/esm/Divider/Divider.js +3 -3
- package/esm/DonutChart/DonutChart.js +22 -7
- package/esm/DragAndDropList/DragAndDropList.js +30 -30
- package/esm/Drawing/Drawing.js +106 -105
- package/esm/DropZone/DropZone.js +35 -35
- package/esm/Emojis/Emojis.js +51 -51
- package/esm/Expand/Expand.js +69 -33
- package/esm/Fab/Fab.js +7 -5
- package/esm/Fade/Fade.js +204 -94
- package/esm/FileChoose/FileChoose.js +25 -25
- package/esm/Focus/Focus.js +7 -7
- package/esm/Form/Form.js +94 -42
- package/esm/FormRow/FormRow.js +88 -33
- package/esm/Forms/Forms.js +35 -13
- package/esm/Frame/Frame.js +7 -7
- package/esm/Grid/Grid.js +10 -10
- package/esm/Grow/Grow.js +216 -101
- package/esm/HTMLCanvas/HTMLCanvas.js +224 -224
- package/esm/IFrame/IFrame.js +4 -4
- package/esm/Icon/Icon.js +80 -38
- package/esm/IconButton/IconButton.js +30 -12
- package/esm/Image/Image.js +12 -12
- package/esm/ImageCrop/ImageCrop.js +237 -237
- package/esm/ImageEdit/ImageEdit.js +188 -188
- package/esm/ImageGallery/ImageGallery.js +54 -54
- package/esm/ImageList/ImageList.js +12 -12
- package/esm/ImageListItem/ImageListItem.js +8 -8
- package/esm/ImageListItemBox/ImageListItemBox.js +29 -10
- package/esm/Info/Info.js +82 -24
- package/esm/Interaction/Interaction.js +37 -37
- package/esm/Keyframes/Keyframes.js +15 -15
- package/esm/Keyframes/useKeyframes.js +1 -1
- package/esm/Label/Label.js +5 -5
- package/esm/Labels/Labels.js +15 -15
- package/esm/Line/Line.js +9 -9
- package/esm/LineChart/LineChart.js +26 -9
- package/esm/LineChartItem/LineChartItem.js +21 -21
- package/esm/LinearMeter/LinearMeter.js +124 -124
- package/esm/LinearProgress/LinearProgress.js +50 -28
- package/esm/Link/Link.js +58 -21
- package/esm/Links/Links.js +108 -53
- package/esm/List/List.js +11 -11
- package/esm/ListItem/ListItem.js +4 -4
- package/esm/ListSubheader/ListSubheader.js +22 -7
- package/esm/MainProgress/MainProgress.js +6 -6
- package/esm/MainProgressMaterial/MainProgressMaterial.js +14 -14
- package/esm/Markdown/Markdown.js +191 -191
- package/esm/Masonry/Masonry.js +24 -24
- package/esm/Medias/Medias.js +77 -77
- package/esm/Menu/Menu.js +44 -44
- package/esm/MenuDesktop/MenuDesktop.js +116 -93
- package/esm/MenuItem/MenuItem.js +39 -39
- package/esm/Meta/Meta.js +56 -25
- package/esm/Modal/Modal.js +10 -10
- package/esm/ModalFooter/ModalFooter.js +29 -10
- package/esm/ModalHeader/ModalHeader.js +31 -11
- package/esm/ModalIcon/ModalIcon.js +1 -1
- package/esm/ModalMain/ModalMain.js +30 -11
- package/esm/ModalText/ModalText.js +27 -9
- package/esm/ModalTitle/ModalTitle.js +27 -9
- package/esm/MoreOptions/MoreOptions.js +42 -19
- package/esm/Move/Move.js +23 -23
- package/esm/NavigationBar/NavigationBar.js +63 -30
- package/esm/NavigationDrawer/NavigationDrawer.js +11 -11
- package/esm/NavigationItem/NavigationItem.js +25 -25
- package/esm/NavigationRail/NavigationRail.js +66 -37
- package/esm/NotFound/NotFound.js +6 -6
- package/esm/NumericTextField/NumericTextField.js +50 -50
- package/esm/Page/Page.js +5 -5
- package/esm/PageTransition/PageTransition.js +6 -6
- package/esm/Pagination/Pagination.js +120 -53
- package/esm/PaginationItem/PaginationItem.js +49 -21
- package/esm/Parallax/Parallax.js +8 -8
- package/esm/Path/Path.js +21 -6
- package/esm/PieChart/PieChart.js +37 -37
- package/esm/Placeholder/Placeholder.js +58 -17
- package/esm/Portal/Portal.js +1 -1
- package/esm/Properties/Properties.js +50 -20
- package/esm/Property/Property.js +3 -3
- package/esm/Radio/Radio.js +82 -18
- package/esm/Radios/Radios.js +5 -5
- package/esm/Rating/Rating.js +66 -66
- package/esm/Reset/Reset.js +26 -4
- package/esm/Reveal/Reveal.js +7 -7
- package/esm/RichTextEditor/RichTextEditor.js +192 -192
- package/esm/RoundMeter/RoundMeter.js +206 -206
- package/esm/RoundProgress/RoundProgress.js +45 -24
- package/esm/ScatterChart/ScatterChart.js +26 -9
- package/esm/ScatterChartItem/ScatterChartItem.js +14 -14
- package/esm/ScreenCapture/ScreenCapture.js +56 -56
- package/esm/Section/Section.js +12 -12
- package/esm/SectionAction/SectionAction.js +3 -3
- package/esm/SectionBoxes/SectionBoxes.js +13 -13
- package/esm/SectionCards/SectionCards.js +13 -13
- package/esm/SectionCarousel/SectionCarousel.js +14 -14
- package/esm/SectionContact/SectionContact.js +5 -5
- package/esm/SectionImageGallery/SectionImageGallery.js +3 -3
- package/esm/SectionLogos/SectionLogos.js +7 -7
- package/esm/SectionMedia/SectionMedia.js +10 -10
- package/esm/SectionReviews/SectionReviews.js +14 -14
- package/esm/SectionTextMedia/SectionTextMedia.js +9 -9
- package/esm/SectionTimeline/SectionTimeline.js +16 -16
- package/esm/SectionWatch/SectionWatch.js +3 -3
- package/esm/Select/Select.js +88 -88
- package/esm/Share/Share.js +216 -92
- package/esm/Slide/Slide.js +15 -15
- package/esm/Slider/Slider.js +149 -149
- package/esm/SmartTextField/SmartTextField.js +199 -198
- package/esm/Snackbar/Snackbar.js +17 -17
- package/esm/Snackbars/Snackbars.js +40 -40
- package/esm/Space/Space.js +755 -480
- package/esm/SpeechToText/SpeechToText.js +25 -25
- package/esm/SpeedDial/SpeedDial.js +68 -40
- package/esm/SpeedDialItem/SpeedDialItem.js +33 -14
- package/esm/SpyScroll/SpyScroll.js +16 -16
- package/esm/Step/Step.js +40 -31
- package/esm/Stepper/Stepper.js +11 -11
- package/esm/Surface/Surface.js +207 -130
- package/esm/Switch/Switch.js +106 -39
- package/esm/Tab/Tab.js +136 -50
- package/esm/Table/Table.js +69 -24
- package/esm/TableBody/TableBody.js +43 -17
- package/esm/TableCell/TableCell.js +25 -25
- package/esm/TableFooter/TableFooter.js +35 -13
- package/esm/TableHead/TableHead.js +14 -14
- package/esm/TableHeader/TableHeader.js +37 -14
- package/esm/TablePagination/TablePagination.js +9 -9
- package/esm/TableRow/TableRow.js +46 -20
- package/esm/Tabs/Tabs.js +38 -38
- package/esm/Text/Text.js +9 -9
- package/esm/TextField/TextField.js +63 -63
- package/esm/TextToSpeech/TextToSpeech.js +20 -20
- package/esm/TimePicker/TimePicker.js +182 -182
- package/esm/TimeRangePicker/TimeRangePicker.js +22 -7
- package/esm/Timeline/Timeline.js +34 -13
- package/esm/TimelineItem/TimelineItem.js +4 -4
- package/esm/Timer/Timer.js +28 -28
- package/esm/ToggleButton/ToggleButton.js +28 -10
- package/esm/ToggleButtons/ToggleButtons.js +23 -9
- package/esm/Tooltip/Tooltip.js +45 -45
- package/esm/TopAppBar/TopAppBar.js +117 -49
- package/esm/Transition/Transition.js +53 -53
- package/esm/Transition/useTransition.js +1 -1
- package/esm/Transitions/Transitions.js +9 -9
- package/esm/Tree/Tree.js +36 -36
- package/esm/Type/Type.js +23 -14
- package/esm/VideoPlayer/VideoPlayer.js +121 -121
- package/esm/ViewSplit/ViewSplit.js +65 -65
- package/esm/Watch/Watch.js +13 -13
- package/esm/Weather/Weather.js +73 -29
- package/esm/Whiteboard/Whiteboard.js +557 -557
- package/esm/Widgets/Widgets.js +29 -29
- package/esm/WindowSplit/WindowSplit.js +51 -51
- package/esm/Zoom/Zoom.js +204 -90
- package/esm/index.js +1 -1
- package/esm/useForm/useForm.js +58 -58
- package/esm/useLocation/useLocation.js +4 -4
- package/esm/useMediaQuery/useMediaQuery.js +2 -2
- package/esm/useOnline/useOnline.js +23 -10
- package/esm/useOpen/useOpen.js +79 -27
- package/esm/useQuery/useQuery.js +11 -1
- package/esm/useResize/useResize.js +30 -14
- package/esm/useScroll/useScroll.js +2 -2
- package/esm/useSubscription/useSubscription.js +73 -21
- package/esm/useSwipe/useSwipe.js +30 -30
- package/esm/useTabs/useTabs.js +22 -7
- package/esm/useVisible/useVisible.js +3 -3
- package/index.js +1 -1
- package/package.json +8 -12
- package/types.d.ts +27 -27
- package/useForm/useForm.d.ts +2 -2
- package/useForm/useForm.js +58 -58
- package/useForm/validate.d.ts +12 -12
- package/useLocation/useLocation.d.ts +1 -1
- package/useLocation/useLocation.js +4 -4
- package/useMediaQuery/useMediaQuery.d.ts +1 -1
- package/useMediaQuery/useMediaQuery.js +2 -2
- package/useOnline/useOnline.js +23 -10
- package/useOpen/useOpen.js +79 -27
- package/useQuery/useQuery.js +11 -1
- package/useResize/useResize.js +30 -14
- package/useScroll/useScroll.d.ts +2 -2
- package/useScroll/useScroll.js +2 -2
- package/useSubscription/useSubscription.js +73 -21
- package/useSwipe/useSwipe.d.ts +2 -2
- package/useSwipe/useSwipe.js +30 -30
- package/useTabs/useTabs.js +22 -7
- package/useVisible/useVisible.d.ts +2 -2
- package/useVisible/useVisible.js +3 -3
|
@@ -64,8 +64,8 @@ const colorSelect = 'hsl(244deg 64% 64%)';
|
|
|
64
64
|
const colorSelectBackground = 'hsla(244deg 64% 64% / 4%)';
|
|
65
65
|
const Whiteboard = /*#__PURE__*/React.forwardRef((props_, ref) => {
|
|
66
66
|
const theme = useOnesyTheme();
|
|
67
|
-
const props =
|
|
68
|
-
const Line =
|
|
67
|
+
const props = _objectSpread(_objectSpread(_objectSpread({}, theme?.ui?.elements?.all?.props?.default), theme?.ui?.elements?.onesyWhiteboard?.props?.default), props_);
|
|
68
|
+
const Line = theme?.elements?.Line || LineElement;
|
|
69
69
|
const {
|
|
70
70
|
valueDefault,
|
|
71
71
|
onChange: onChangeProps,
|
|
@@ -158,7 +158,7 @@ const Whiteboard = /*#__PURE__*/React.forwardRef((props_, ref) => {
|
|
|
158
158
|
refs.mouseDown.current = mouseDown;
|
|
159
159
|
refs.tool.current = tool;
|
|
160
160
|
refs.grid.current = grid;
|
|
161
|
-
const init =
|
|
161
|
+
const init = () => {
|
|
162
162
|
// Todo
|
|
163
163
|
// items
|
|
164
164
|
// load all of the images in memory and attach theme to items as image elements
|
|
@@ -168,24 +168,24 @@ const Whiteboard = /*#__PURE__*/React.forwardRef((props_, ref) => {
|
|
|
168
168
|
render();
|
|
169
169
|
setLoaded(true);
|
|
170
170
|
}, 40);
|
|
171
|
-
}
|
|
171
|
+
};
|
|
172
172
|
React.useEffect(() => {
|
|
173
173
|
if (!['zoom'].includes(tool)) refs.previousTool.current = tool;
|
|
174
174
|
}, [tool]);
|
|
175
|
-
const onChange =
|
|
175
|
+
const onChange = () => {
|
|
176
176
|
if (is('function', onChangeProps)) onChangeProps(refs.items.current);
|
|
177
|
-
}
|
|
178
|
-
const getItems =
|
|
179
|
-
const getItem =
|
|
180
|
-
const filterItems =
|
|
181
|
-
const toRemove = refs.items.current.filter(
|
|
182
|
-
if (refs.tool.current === 'text' &&
|
|
183
|
-
const lines =
|
|
184
|
-
return !(
|
|
177
|
+
};
|
|
178
|
+
const getItems = (selected = undefined) => refs.items.current.filter(item => selected === undefined || item.se === selected);
|
|
179
|
+
const getItem = () => refs.items.current[refs.items.current.length - 1];
|
|
180
|
+
const filterItems = () => {
|
|
181
|
+
const toRemove = refs.items.current.filter(item_0 => {
|
|
182
|
+
if (refs.tool.current === 'text' && item_0 !== refs.textActive.current) item_0.se = false;
|
|
183
|
+
const lines = item_0.s?.lines || [];
|
|
184
|
+
return !(item_0.v !== 't' || item_0 === refs.textActive.current || lines.length > 1 || lines[0].length);
|
|
185
185
|
});
|
|
186
186
|
if (toRemove.length) remove(toRemove);
|
|
187
|
-
}
|
|
188
|
-
const add =
|
|
187
|
+
};
|
|
188
|
+
const add = toAdd => {
|
|
189
189
|
const itemsAdd = (Array.isArray(toAdd) ? toAdd : [toAdd]).filter(Boolean);
|
|
190
190
|
const items = getItems();
|
|
191
191
|
|
|
@@ -195,22 +195,22 @@ const Whiteboard = /*#__PURE__*/React.forwardRef((props_, ref) => {
|
|
|
195
195
|
// clear redo stack
|
|
196
196
|
refs.redo.current = [];
|
|
197
197
|
refs.items.current.push(...itemsAdd);
|
|
198
|
-
}
|
|
199
|
-
const remove =
|
|
200
|
-
const itemsRemove = (Array.isArray(
|
|
201
|
-
const
|
|
202
|
-
const IDs = itemsRemove?.map(
|
|
203
|
-
const toRemoveIDs =
|
|
198
|
+
};
|
|
199
|
+
const remove = toRemove_0 => {
|
|
200
|
+
const itemsRemove = (Array.isArray(toRemove_0) ? toRemove_0 : [toRemove_0]).filter(Boolean);
|
|
201
|
+
const items_0 = getItems();
|
|
202
|
+
const IDs = itemsRemove?.map(item_1 => item_1.i);
|
|
203
|
+
const toRemoveIDs = items_0.filter(item_2 => IDs.includes(item_2.i)).map(item_3 => item_3.i);
|
|
204
204
|
if (!toRemoveIDs) return;
|
|
205
205
|
|
|
206
206
|
// add to undo stack snapshot of current state
|
|
207
|
-
refs.undo.current.push([...
|
|
207
|
+
refs.undo.current.push([...items_0]);
|
|
208
208
|
|
|
209
209
|
// clear redo stack
|
|
210
210
|
refs.redo.current = [];
|
|
211
|
-
refs.items.current = refs.items.current.filter(
|
|
212
|
-
}
|
|
213
|
-
const reset =
|
|
211
|
+
refs.items.current = refs.items.current.filter(item_4 => !toRemoveIDs.includes(item_4.i));
|
|
212
|
+
};
|
|
213
|
+
const reset = () => {
|
|
214
214
|
refs.on.current = false;
|
|
215
215
|
refs.moveStarted.current = false;
|
|
216
216
|
refs.image.current = null;
|
|
@@ -218,25 +218,25 @@ const Whiteboard = /*#__PURE__*/React.forwardRef((props_, ref) => {
|
|
|
218
218
|
// new move start
|
|
219
219
|
refs.offset.current.x = refs.move.current.x;
|
|
220
220
|
refs.offset.current.y = refs.move.current.y;
|
|
221
|
-
}
|
|
222
|
-
const transform =
|
|
223
|
-
const selectAll =
|
|
224
|
-
return [...refs.items.current].filter(Boolean).map(
|
|
225
|
-
|
|
226
|
-
return
|
|
221
|
+
};
|
|
222
|
+
const transform = coordinate => coordinate / refs.scale.current;
|
|
223
|
+
const selectAll = () => {
|
|
224
|
+
return [...refs.items.current].filter(Boolean).map(item_5 => {
|
|
225
|
+
item_5.se = true;
|
|
226
|
+
return item_5;
|
|
227
227
|
});
|
|
228
|
-
}
|
|
229
|
-
const unselectAll =
|
|
228
|
+
};
|
|
229
|
+
const unselectAll = eventReact => {
|
|
230
230
|
const event = eventReact?.nativeEvent || eventReact;
|
|
231
231
|
const shift = event?.shiftKey;
|
|
232
|
-
return [...refs.items.current].filter(Boolean).map(
|
|
233
|
-
if (shift) return
|
|
234
|
-
|
|
235
|
-
return
|
|
232
|
+
return [...refs.items.current].filter(Boolean).map(item_6 => {
|
|
233
|
+
if (shift) return item_6;
|
|
234
|
+
item_6.se = false;
|
|
235
|
+
return item_6;
|
|
236
236
|
});
|
|
237
|
-
}
|
|
238
|
-
const onInteractionDown =
|
|
239
|
-
const
|
|
237
|
+
};
|
|
238
|
+
const onInteractionDown = (body, eventReact_0) => {
|
|
239
|
+
const event_0 = eventReact_0?.nativeEvent || eventReact_0;
|
|
240
240
|
const {
|
|
241
241
|
offsetX: x,
|
|
242
242
|
offsetY: y,
|
|
@@ -259,7 +259,7 @@ const Whiteboard = /*#__PURE__*/React.forwardRef((props_, ref) => {
|
|
|
259
259
|
y: 0
|
|
260
260
|
}
|
|
261
261
|
};
|
|
262
|
-
const
|
|
262
|
+
const shift_0 = event_0?.shiftKey;
|
|
263
263
|
const ui = refs.ui.current.getContext('2d');
|
|
264
264
|
const rect = refs.ui.current.getBoundingClientRect();
|
|
265
265
|
refs.start.current.x = clientX - rect.left;
|
|
@@ -271,15 +271,15 @@ const Whiteboard = /*#__PURE__*/React.forwardRef((props_, ref) => {
|
|
|
271
271
|
y: transform(start.y - refs.move.current.y)
|
|
272
272
|
};
|
|
273
273
|
Object.keys(settings).forEach(item_ => ui[item_] = settings[item_]);
|
|
274
|
-
let
|
|
275
|
-
const
|
|
274
|
+
let item_7;
|
|
275
|
+
const items_1 = getItems();
|
|
276
276
|
const t = refs.tool.current;
|
|
277
277
|
refs.select.current = null;
|
|
278
278
|
if (t === 'select') {
|
|
279
279
|
// z-index top to bottom order
|
|
280
|
-
const itemsReversed = [...
|
|
281
|
-
const itemsClicked = itemsReversed.filter(
|
|
282
|
-
return
|
|
280
|
+
const itemsReversed = [...items_1].reverse();
|
|
281
|
+
const itemsClicked = itemsReversed.filter(item__0 => {
|
|
282
|
+
return item__0.c && startTransformed.x >= item__0.c[0] && startTransformed.x <= item__0.c[0] + item__0.c[2] && startTransformed.y >= item__0.c[1] && startTransformed.y <= item__0.c[1] + item__0.c[3];
|
|
283
283
|
});
|
|
284
284
|
const itemsSelected = getItems(true);
|
|
285
285
|
const clicked = itemsClicked[0];
|
|
@@ -290,16 +290,16 @@ const Whiteboard = /*#__PURE__*/React.forwardRef((props_, ref) => {
|
|
|
290
290
|
ar: []
|
|
291
291
|
};
|
|
292
292
|
}
|
|
293
|
-
if (!
|
|
293
|
+
if (!shift_0 && !(clicked?.se && itemsSelected.length > 1)) unselectAll();
|
|
294
294
|
if (clicked) {
|
|
295
|
-
clicked.se =
|
|
295
|
+
clicked.se = shift_0 ? !clicked.se : true;
|
|
296
296
|
}
|
|
297
297
|
} else if (t === 'text') {
|
|
298
298
|
const {
|
|
299
299
|
lineHeight,
|
|
300
300
|
padding
|
|
301
301
|
} = refs.textSettings.current;
|
|
302
|
-
const selectedText =
|
|
302
|
+
const selectedText = items_1.find(item__1 => item__1.c && startTransformed.x >= item__1.c[0] && startTransformed.x <= item__1.c[0] + item__1.c[2] && startTransformed.y >= item__1.c[1] && startTransformed.y <= item__1.c[1] + item__1.c[3]);
|
|
303
303
|
if (selectedText) {
|
|
304
304
|
refs.textActive.current = selectedText;
|
|
305
305
|
selectedText.se = true;
|
|
@@ -319,7 +319,7 @@ const Whiteboard = /*#__PURE__*/React.forwardRef((props_, ref) => {
|
|
|
319
319
|
char: charIndex
|
|
320
320
|
};
|
|
321
321
|
} else {
|
|
322
|
-
|
|
322
|
+
item_7 = {
|
|
323
323
|
i: getID(),
|
|
324
324
|
v: 't',
|
|
325
325
|
p: [startTransformed.x, startTransformed.y],
|
|
@@ -334,13 +334,13 @@ const Whiteboard = /*#__PURE__*/React.forwardRef((props_, ref) => {
|
|
|
334
334
|
se: true,
|
|
335
335
|
a: OnesyDate.milliseconds
|
|
336
336
|
};
|
|
337
|
-
refs.textActive.current =
|
|
337
|
+
refs.textActive.current = item_7;
|
|
338
338
|
}
|
|
339
339
|
} else {
|
|
340
340
|
// pen
|
|
341
341
|
if (t === 'pen') {
|
|
342
342
|
// point
|
|
343
|
-
|
|
343
|
+
item_7 = {
|
|
344
344
|
i: getID(),
|
|
345
345
|
v: 'dp',
|
|
346
346
|
p: [transform(x - refs.move.current.x), transform(y - refs.move.current.y)],
|
|
@@ -351,7 +351,7 @@ const Whiteboard = /*#__PURE__*/React.forwardRef((props_, ref) => {
|
|
|
351
351
|
}
|
|
352
352
|
// circle, rectangle, line, line-arrow
|
|
353
353
|
if (['circle', 'rectangle', 'triangle', 'line', 'line-arrow'].includes(t)) {
|
|
354
|
-
|
|
354
|
+
item_7 = {
|
|
355
355
|
i: getID(),
|
|
356
356
|
p: [],
|
|
357
357
|
ar: [],
|
|
@@ -372,7 +372,7 @@ const Whiteboard = /*#__PURE__*/React.forwardRef((props_, ref) => {
|
|
|
372
372
|
// Todo
|
|
373
373
|
// add url of the image
|
|
374
374
|
// instead of embeding the image
|
|
375
|
-
|
|
375
|
+
item_7 = {
|
|
376
376
|
i: getID(),
|
|
377
377
|
v: 'i',
|
|
378
378
|
p: [],
|
|
@@ -387,116 +387,116 @@ const Whiteboard = /*#__PURE__*/React.forwardRef((props_, ref) => {
|
|
|
387
387
|
};
|
|
388
388
|
}
|
|
389
389
|
}
|
|
390
|
-
if (
|
|
390
|
+
if (item_7) add(item_7);
|
|
391
391
|
filterItems();
|
|
392
392
|
|
|
393
393
|
// render
|
|
394
394
|
render();
|
|
395
395
|
setMouseDown(true);
|
|
396
|
-
}
|
|
397
|
-
const onMouseDown =
|
|
396
|
+
};
|
|
397
|
+
const onMouseDown = event_1 => {
|
|
398
398
|
const {
|
|
399
399
|
offsetX,
|
|
400
400
|
offsetY,
|
|
401
|
-
clientX,
|
|
402
|
-
clientY
|
|
403
|
-
} =
|
|
401
|
+
clientX: clientX_0,
|
|
402
|
+
clientY: clientY_0
|
|
403
|
+
} = event_1.nativeEvent;
|
|
404
404
|
onInteractionDown({
|
|
405
405
|
offsetX,
|
|
406
406
|
offsetY,
|
|
407
|
-
clientX,
|
|
408
|
-
clientY
|
|
409
|
-
},
|
|
410
|
-
}
|
|
411
|
-
const onTouchStart =
|
|
407
|
+
clientX: clientX_0,
|
|
408
|
+
clientY: clientY_0
|
|
409
|
+
}, event_1);
|
|
410
|
+
};
|
|
411
|
+
const onTouchStart = event_2 => {
|
|
412
412
|
// Get the first touch point
|
|
413
|
-
const touch =
|
|
413
|
+
const touch = event_2.touches[0];
|
|
414
414
|
const {
|
|
415
|
-
clientX,
|
|
416
|
-
clientY
|
|
415
|
+
clientX: clientX_1,
|
|
416
|
+
clientY: clientY_1
|
|
417
417
|
} = touch;
|
|
418
418
|
let {
|
|
419
|
-
offsetX,
|
|
420
|
-
offsetY
|
|
419
|
+
offsetX: offsetX_0,
|
|
420
|
+
offsetY: offsetY_0
|
|
421
421
|
} = touch;
|
|
422
422
|
const targetElement = touch.target;
|
|
423
423
|
if (targetElement instanceof HTMLElement) {
|
|
424
424
|
// Get the bounding rectangle of the target element
|
|
425
|
-
const
|
|
425
|
+
const rect_0 = targetElement.getBoundingClientRect();
|
|
426
426
|
|
|
427
427
|
// Calculate the offsetX and offsetY
|
|
428
|
-
|
|
429
|
-
|
|
428
|
+
offsetX_0 = touch.clientX - rect_0.left;
|
|
429
|
+
offsetY_0 = touch.clientY - rect_0.top;
|
|
430
430
|
}
|
|
431
431
|
onInteractionDown({
|
|
432
|
-
offsetX,
|
|
433
|
-
offsetY,
|
|
434
|
-
clientX,
|
|
435
|
-
clientY
|
|
436
|
-
},
|
|
437
|
-
}
|
|
438
|
-
const removeItems =
|
|
432
|
+
offsetX: offsetX_0,
|
|
433
|
+
offsetY: offsetY_0,
|
|
434
|
+
clientX: clientX_1,
|
|
435
|
+
clientY: clientY_1
|
|
436
|
+
}, event_2);
|
|
437
|
+
};
|
|
438
|
+
const removeItems = () => {
|
|
439
439
|
// remove
|
|
440
440
|
if (refs.remove.current.length) {
|
|
441
|
-
const
|
|
442
|
-
for (const
|
|
443
|
-
const index = refs.items.current.findIndex(itemItems => itemItems ===
|
|
444
|
-
if (index > -1)
|
|
441
|
+
const toRemove_1 = [];
|
|
442
|
+
for (const item_8 of refs.remove.current) {
|
|
443
|
+
const index = refs.items.current.findIndex(itemItems => itemItems === item_8);
|
|
444
|
+
if (index > -1) toRemove_1.push(item_8);
|
|
445
445
|
}
|
|
446
|
-
if (
|
|
446
|
+
if (toRemove_1.length) remove(toRemove_1);
|
|
447
447
|
refs.remove.current = [];
|
|
448
448
|
}
|
|
449
|
-
}
|
|
450
|
-
const onUpdateCoordinates =
|
|
451
|
-
const
|
|
452
|
-
|
|
453
|
-
const p =
|
|
454
|
-
const ar =
|
|
455
|
-
const s =
|
|
449
|
+
};
|
|
450
|
+
const onUpdateCoordinates = () => {
|
|
451
|
+
const items_2 = getItems();
|
|
452
|
+
items_2.forEach(item_9 => {
|
|
453
|
+
const p = item_9?.p || [];
|
|
454
|
+
const ar = item_9?.ar || [];
|
|
455
|
+
const s = item_9?.s || {};
|
|
456
456
|
if (p.length) {
|
|
457
457
|
// cache
|
|
458
458
|
// x1, y1, width. height for position on the screen
|
|
459
|
-
const v =
|
|
459
|
+
const v = item_9.v;
|
|
460
460
|
|
|
461
461
|
// draw point
|
|
462
462
|
if (v === 'dp') {
|
|
463
463
|
const lineWidth = s.lineWidth || 10;
|
|
464
|
-
|
|
464
|
+
item_9.c = [p[0] - lineWidth / 2, p[1] - lineWidth / 2, lineWidth, lineWidth];
|
|
465
465
|
}
|
|
466
466
|
// draw line
|
|
467
467
|
else if (v === 'dl') {
|
|
468
|
-
const
|
|
469
|
-
const
|
|
470
|
-
for (let
|
|
471
|
-
|
|
472
|
-
|
|
468
|
+
const x_0 = [];
|
|
469
|
+
const y_0 = [];
|
|
470
|
+
for (let i_0 = 0; i_0 < p.length; i_0 += 2) {
|
|
471
|
+
x_0.push(p[i_0]);
|
|
472
|
+
y_0.push(p[i_0 + 1]);
|
|
473
473
|
}
|
|
474
|
-
const xMin = Math.min(...
|
|
475
|
-
const yMin = Math.min(...
|
|
476
|
-
const xMax = Math.max(...
|
|
477
|
-
const yMax = Math.max(...
|
|
478
|
-
|
|
474
|
+
const xMin = Math.min(...x_0);
|
|
475
|
+
const yMin = Math.min(...y_0);
|
|
476
|
+
const xMax = Math.max(...x_0);
|
|
477
|
+
const yMax = Math.max(...y_0);
|
|
478
|
+
item_9.c = [xMin, yMin, xMax - xMin, yMax - yMin];
|
|
479
479
|
}
|
|
480
480
|
// object line, object arrow
|
|
481
481
|
else if (['ol', 'oa'].includes(v)) {
|
|
482
|
-
const
|
|
483
|
-
const
|
|
484
|
-
const
|
|
485
|
-
const
|
|
486
|
-
const
|
|
487
|
-
const
|
|
488
|
-
|
|
482
|
+
const x_1 = [p[0], ar[0]];
|
|
483
|
+
const y_1 = [p[1], ar[1]];
|
|
484
|
+
const xMin_0 = Math.min(...x_1);
|
|
485
|
+
const yMin_0 = Math.min(...y_1);
|
|
486
|
+
const xMax_0 = Math.max(...x_1);
|
|
487
|
+
const yMax_0 = Math.max(...y_1);
|
|
488
|
+
item_9.c = [xMin_0, yMin_0, xMax_0 - xMin_0, yMax_0 - yMin_0];
|
|
489
489
|
}
|
|
490
490
|
// object rectangle, object square
|
|
491
491
|
else if (['or', 'os'].includes(v)) {
|
|
492
|
-
|
|
492
|
+
item_9.c = [...p, ...ar];
|
|
493
493
|
}
|
|
494
494
|
// object circle, object ellipse
|
|
495
495
|
else if (['oc', 'oe'].includes(v)) {
|
|
496
496
|
if (v === 'oc') {
|
|
497
|
-
|
|
497
|
+
item_9.c = [p[0] - ar[0], p[1] - ar[0], ar[0] * 2, ar[0] * 2];
|
|
498
498
|
} else {
|
|
499
|
-
|
|
499
|
+
item_9.c = [p[0] - ar[0], p[1] - ar[1], ar[0] * 2, ar[1] * 2];
|
|
500
500
|
}
|
|
501
501
|
}
|
|
502
502
|
// object triangle, object triangle equilateral
|
|
@@ -505,16 +505,16 @@ const Whiteboard = /*#__PURE__*/React.forwardRef((props_, ref) => {
|
|
|
505
505
|
const {
|
|
506
506
|
height
|
|
507
507
|
} = s;
|
|
508
|
-
|
|
508
|
+
item_9.c = [x1, y1 - height, x2 - x1, height];
|
|
509
509
|
}
|
|
510
510
|
// image
|
|
511
511
|
else if (['i', 't'].includes(v)) {
|
|
512
|
-
|
|
512
|
+
item_9.c = [...p, ...ar];
|
|
513
513
|
}
|
|
514
514
|
}
|
|
515
515
|
});
|
|
516
|
-
}
|
|
517
|
-
const onSelect =
|
|
516
|
+
};
|
|
517
|
+
const onSelect = () => {
|
|
518
518
|
const select = refs.select.current;
|
|
519
519
|
if (!select) return;
|
|
520
520
|
const px1 = select.p[0];
|
|
@@ -529,28 +529,28 @@ const Whiteboard = /*#__PURE__*/React.forwardRef((props_, ref) => {
|
|
|
529
529
|
x: Math.max(px1, px2),
|
|
530
530
|
y: Math.max(py1, py2)
|
|
531
531
|
};
|
|
532
|
-
const
|
|
533
|
-
|
|
532
|
+
const items_3 = getItems();
|
|
533
|
+
items_3.forEach(item_10 => {
|
|
534
534
|
const {
|
|
535
535
|
c
|
|
536
|
-
} =
|
|
537
|
-
const [
|
|
538
|
-
let [
|
|
539
|
-
|
|
540
|
-
y2 =
|
|
536
|
+
} = item_10;
|
|
537
|
+
const [x1_0, y1_0] = c;
|
|
538
|
+
let [x2_0, y2] = c;
|
|
539
|
+
x2_0 = x1_0 + x2_0;
|
|
540
|
+
y2 = y1_0 + y2;
|
|
541
541
|
const minItem = {
|
|
542
|
-
x: Math.min(
|
|
543
|
-
y: Math.min(
|
|
542
|
+
x: Math.min(x1_0, x2_0),
|
|
543
|
+
y: Math.min(y1_0, y2)
|
|
544
544
|
};
|
|
545
545
|
const maxItem = {
|
|
546
|
-
x: Math.max(
|
|
547
|
-
y: Math.max(
|
|
546
|
+
x: Math.max(x1_0, x2_0),
|
|
547
|
+
y: Math.max(y1_0, y2)
|
|
548
548
|
};
|
|
549
|
-
const
|
|
550
|
-
if (
|
|
549
|
+
const selected_0 = minItem.x >= min.x && maxItem.x <= max.x && minItem.y >= min.y && maxItem.y <= max.y;
|
|
550
|
+
if (selected_0) item_10.se = true;
|
|
551
551
|
});
|
|
552
|
-
}
|
|
553
|
-
const onMouseUp =
|
|
552
|
+
};
|
|
553
|
+
const onMouseUp = event_3 => {
|
|
554
554
|
if (refs.mouseDown.current) {
|
|
555
555
|
refs.select.current = null;
|
|
556
556
|
|
|
@@ -572,37 +572,37 @@ const Whiteboard = /*#__PURE__*/React.forwardRef((props_, ref) => {
|
|
|
572
572
|
}
|
|
573
573
|
render();
|
|
574
574
|
}
|
|
575
|
-
}
|
|
576
|
-
const updateTextBoxDimensions =
|
|
577
|
-
const
|
|
575
|
+
};
|
|
576
|
+
const updateTextBoxDimensions = item_11 => {
|
|
577
|
+
const ui_0 = refs.ui.current.getContext('2d');
|
|
578
578
|
const {
|
|
579
|
-
lineHeight,
|
|
580
|
-
padding
|
|
579
|
+
lineHeight: lineHeight_0,
|
|
580
|
+
padding: padding_0
|
|
581
581
|
} = refs.textSettings.current;
|
|
582
|
-
|
|
583
|
-
const maxWidth = Math.max(...
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
}
|
|
587
|
-
const getPath =
|
|
582
|
+
ui_0.font = '16px Arial';
|
|
583
|
+
const maxWidth = Math.max(...item_11.s.lines.map(line => ui_0.measureText(line).width));
|
|
584
|
+
item_11.ar[0] = maxWidth + padding_0 * 2.5;
|
|
585
|
+
item_11.ar[1] = item_11.s.lines.length * lineHeight_0 + padding_0 * 2;
|
|
586
|
+
};
|
|
587
|
+
const getPath = item_12 => {
|
|
588
588
|
const path = new Path2D();
|
|
589
589
|
const {
|
|
590
|
-
v,
|
|
591
|
-
p,
|
|
592
|
-
ar
|
|
593
|
-
} =
|
|
590
|
+
v: v_0,
|
|
591
|
+
p: p_0,
|
|
592
|
+
ar: ar_0
|
|
593
|
+
} = item_12;
|
|
594
594
|
|
|
595
595
|
// draw line
|
|
596
|
-
if (
|
|
597
|
-
const points = arrayToParts(
|
|
598
|
-
for (let
|
|
599
|
-
const current = points[
|
|
600
|
-
const next = points[
|
|
596
|
+
if (v_0 === 'dl') {
|
|
597
|
+
const points = arrayToParts(p_0, 2);
|
|
598
|
+
for (let i_1 = 0; i_1 < points.length - 1; i_1++) {
|
|
599
|
+
const current = points[i_1];
|
|
600
|
+
const next = points[i_1 + 1];
|
|
601
601
|
|
|
602
602
|
// calculate the control point for the curve
|
|
603
603
|
const midX = (current[0] + next[0]) / 2;
|
|
604
604
|
const midY = (current[1] + next[1]) / 2;
|
|
605
|
-
if (
|
|
605
|
+
if (i_1 === 0) {
|
|
606
606
|
// start from the first point
|
|
607
607
|
path.moveTo(current[0], current[1]);
|
|
608
608
|
}
|
|
@@ -610,304 +610,304 @@ const Whiteboard = /*#__PURE__*/React.forwardRef((props_, ref) => {
|
|
|
610
610
|
}
|
|
611
611
|
}
|
|
612
612
|
// draw point, object circle
|
|
613
|
-
else if (['dp', 'oc'].includes(
|
|
614
|
-
path.arc(
|
|
613
|
+
else if (['dp', 'oc'].includes(v_0) && ar_0.length === 3) {
|
|
614
|
+
path.arc(p_0[0], p_0[1], ...ar_0);
|
|
615
615
|
}
|
|
616
616
|
// object ellipse
|
|
617
|
-
else if (
|
|
618
|
-
path.ellipse(
|
|
617
|
+
else if (v_0 === 'oe' && ar_0.length === 5) {
|
|
618
|
+
path.ellipse(p_0[0], p_0[1], ...ar_0);
|
|
619
619
|
}
|
|
620
620
|
// object rectangle
|
|
621
|
-
else if (['or', 'os'].includes(
|
|
622
|
-
path.roundRect(
|
|
621
|
+
else if (['or', 'os'].includes(v_0)) {
|
|
622
|
+
path.roundRect(p_0[0], p_0[1], ...ar_0);
|
|
623
623
|
}
|
|
624
624
|
// object line
|
|
625
|
-
else if (['ol', 'oa'].includes(
|
|
626
|
-
path.moveTo(
|
|
627
|
-
path.lineTo(...
|
|
625
|
+
else if (['ol', 'oa'].includes(v_0) && ar_0.length === 2) {
|
|
626
|
+
path.moveTo(p_0[0], p_0[1]);
|
|
627
|
+
path.lineTo(...ar_0);
|
|
628
628
|
|
|
629
629
|
// draw an arrow
|
|
630
|
-
if (
|
|
630
|
+
if (v_0 === 'oa') {
|
|
631
631
|
// Length of the arrowhead
|
|
632
632
|
const headLength = 40;
|
|
633
|
-
const angle = Math.atan2(
|
|
634
|
-
path.moveTo(
|
|
635
|
-
path.lineTo(
|
|
636
|
-
path.moveTo(
|
|
637
|
-
path.lineTo(
|
|
633
|
+
const angle = Math.atan2(ar_0[1] - p_0[1], ar_0[0] - p_0[0]);
|
|
634
|
+
path.moveTo(ar_0[0], ar_0[1]);
|
|
635
|
+
path.lineTo(ar_0[0] - headLength * Math.cos(angle - Math.PI / 6), ar_0[1] - headLength * Math.sin(angle - Math.PI / 6));
|
|
636
|
+
path.moveTo(ar_0[0], ar_0[1]);
|
|
637
|
+
path.lineTo(ar_0[0] - headLength * Math.cos(angle + Math.PI / 6), ar_0[1] - headLength * Math.sin(angle + Math.PI / 6));
|
|
638
638
|
}
|
|
639
639
|
}
|
|
640
640
|
// object triangle
|
|
641
|
-
else if (['ot', 'ote'].includes(
|
|
642
|
-
path.moveTo(
|
|
643
|
-
path.lineTo(
|
|
644
|
-
path.lineTo(
|
|
641
|
+
else if (['ot', 'ote'].includes(v_0)) {
|
|
642
|
+
path.moveTo(p_0[0], p_0[1]);
|
|
643
|
+
path.lineTo(p_0[2], p_0[3]);
|
|
644
|
+
path.lineTo(p_0[4], p_0[5]);
|
|
645
645
|
path.closePath();
|
|
646
646
|
}
|
|
647
647
|
return path;
|
|
648
|
-
}
|
|
649
|
-
const draw =
|
|
650
|
-
const
|
|
648
|
+
};
|
|
649
|
+
const draw = item_13 => {
|
|
650
|
+
const ui_1 = refs.ui.current.getContext('2d');
|
|
651
651
|
|
|
652
652
|
// settings
|
|
653
|
-
Object.keys(
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
const
|
|
657
|
-
const
|
|
658
|
-
if (['dp'].includes(
|
|
659
|
-
}
|
|
660
|
-
const drawGrid =
|
|
653
|
+
Object.keys(item_13.s || {}).forEach(key => ui_1[key] = item_13.s?.[key]);
|
|
654
|
+
ui_1.globalAlpha = refs.remove.current.includes(item_13) ? 0.25 : item_13.s?.globalAlpha !== undefined ? item_13.s?.globalAlpha : 1;
|
|
655
|
+
ui_1.beginPath();
|
|
656
|
+
const path_0 = getPath(item_13);
|
|
657
|
+
const v_1 = item_13.v;
|
|
658
|
+
if (['dp'].includes(v_1)) ui_1.fill(path_0);else if (['dl', 'oc', 'oe', 'or', 'os', 'ol', 'oa', 'ot', 'ote'].includes(v_1)) ui_1.stroke(path_0);
|
|
659
|
+
};
|
|
660
|
+
const drawGrid = () => {
|
|
661
661
|
const uiCanvas = refs.ui.current;
|
|
662
|
-
const
|
|
662
|
+
const ui_2 = refs.ui.current.getContext('2d');
|
|
663
663
|
const zoom = refs.scale.current;
|
|
664
664
|
const gridSize = 70;
|
|
665
|
-
const
|
|
666
|
-
const
|
|
665
|
+
const offsetX_1 = refs.move.current.x / zoom;
|
|
666
|
+
const offsetY_1 = refs.move.current.y / zoom;
|
|
667
667
|
|
|
668
668
|
// Calculate start positions based on offsets
|
|
669
|
-
const startX = Math.floor(-
|
|
670
|
-
const startY = Math.floor(-
|
|
669
|
+
const startX = Math.floor(-offsetX_1 / gridSize) * gridSize;
|
|
670
|
+
const startY = Math.floor(-offsetY_1 / gridSize) * gridSize;
|
|
671
671
|
const width = uiCanvas.clientWidth * 1.5 / (zoom < 1 ? zoom : 1);
|
|
672
|
-
const
|
|
672
|
+
const height_0 = uiCanvas.clientHeight * 1.5 / (zoom < 1 ? zoom : 1);
|
|
673
673
|
if (gridSize < 30) return;
|
|
674
674
|
|
|
675
675
|
// Draw main grid lines
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
676
|
+
ui_2.globalAlpha = 1;
|
|
677
|
+
ui_2.lineWidth = (zoom < 0.5 ? 0.3 : zoom <= 1 ? 0.5 : 0.7) / zoom;
|
|
678
|
+
ui_2.strokeStyle = '#ccc';
|
|
679
679
|
|
|
680
680
|
// grid
|
|
681
|
-
for (let
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
681
|
+
for (let x_2 = startX; x_2 < width + Math.abs(startX); x_2 += gridSize) {
|
|
682
|
+
ui_2.beginPath();
|
|
683
|
+
ui_2.moveTo(x_2, startY);
|
|
684
|
+
ui_2.lineTo(x_2, height_0 + startY);
|
|
685
|
+
ui_2.stroke();
|
|
686
686
|
}
|
|
687
|
-
for (let
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
687
|
+
for (let y_2 = startY; y_2 < height_0 + Math.abs(startY); y_2 += gridSize) {
|
|
688
|
+
ui_2.beginPath();
|
|
689
|
+
ui_2.moveTo(startX, y_2);
|
|
690
|
+
ui_2.lineTo(width + startX, y_2);
|
|
691
|
+
ui_2.stroke();
|
|
692
692
|
}
|
|
693
693
|
|
|
694
694
|
// subgrid
|
|
695
695
|
if (gridSize * zoom > 100) {
|
|
696
696
|
// Draw subgrid lines if zoomed in
|
|
697
697
|
const subGridSize = gridSize / 5;
|
|
698
|
-
|
|
699
|
-
|
|
698
|
+
ui_2.lineWidth = (zoom <= 5 ? 0.6 : zoom <= 10 ? 0.8 : 1) / zoom;
|
|
699
|
+
ui_2.strokeStyle = '#ddd';
|
|
700
700
|
const dash = zoom < 1 ? 3 * zoom : 3 / zoom;
|
|
701
|
-
|
|
702
|
-
for (let
|
|
701
|
+
ui_2.setLineDash([dash, dash]);
|
|
702
|
+
for (let x_3 = startX; x_3 < width + Math.abs(startX); x_3 += subGridSize) {
|
|
703
703
|
// without overlap
|
|
704
|
-
if (!(
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
704
|
+
if (!(x_3 % gridSize)) continue;
|
|
705
|
+
ui_2.beginPath();
|
|
706
|
+
ui_2.moveTo(x_3, startY);
|
|
707
|
+
ui_2.lineTo(x_3, height_0 + startY);
|
|
708
|
+
ui_2.stroke();
|
|
709
709
|
}
|
|
710
|
-
for (let
|
|
710
|
+
for (let y_3 = startY; y_3 < height_0 + Math.abs(startY); y_3 += subGridSize) {
|
|
711
711
|
// without overlap
|
|
712
|
-
if (!(
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
712
|
+
if (!(y_3 % gridSize)) continue;
|
|
713
|
+
ui_2.beginPath();
|
|
714
|
+
ui_2.moveTo(startX, y_3);
|
|
715
|
+
ui_2.lineTo(width + startX, y_3);
|
|
716
|
+
ui_2.stroke();
|
|
717
717
|
}
|
|
718
|
-
|
|
718
|
+
ui_2.setLineDash([]); // Reset line dash
|
|
719
719
|
}
|
|
720
|
-
}
|
|
721
|
-
const drawImage =
|
|
722
|
-
const
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
}
|
|
726
|
-
const drawCursor =
|
|
727
|
-
if (!
|
|
728
|
-
const
|
|
720
|
+
};
|
|
721
|
+
const drawImage = item_14 => {
|
|
722
|
+
const ui_3 = refs.ui.current.getContext('2d');
|
|
723
|
+
ui_3.globalAlpha = 1;
|
|
724
|
+
ui_3.drawImage(item_14.s.image || refs.image.current, ...item_14.p, ...item_14.ar);
|
|
725
|
+
};
|
|
726
|
+
const drawCursor = item_15 => {
|
|
727
|
+
if (!item_15 || !item_15.s.cursor) return;
|
|
728
|
+
const ui_4 = refs.ui.current.getContext('2d');
|
|
729
729
|
const {
|
|
730
|
-
line,
|
|
730
|
+
line: line_0,
|
|
731
731
|
char
|
|
732
|
-
} =
|
|
733
|
-
const currentLine =
|
|
734
|
-
const textWidth =
|
|
732
|
+
} = item_15.s.cursor;
|
|
733
|
+
const currentLine = item_15.s.lines[line_0] || '';
|
|
734
|
+
const textWidth = ui_4.measureText(currentLine.slice(0, char)).width;
|
|
735
735
|
const {
|
|
736
|
-
padding,
|
|
737
|
-
lineHeight
|
|
736
|
+
padding: padding_1,
|
|
737
|
+
lineHeight: lineHeight_1
|
|
738
738
|
} = refs.textSettings.current;
|
|
739
|
-
const cursorX =
|
|
740
|
-
const cursorY =
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
}
|
|
744
|
-
const drawText =
|
|
745
|
-
const
|
|
746
|
-
const
|
|
747
|
-
const [
|
|
748
|
-
const [
|
|
739
|
+
const cursorX = item_15.p[0] + padding_1 + textWidth;
|
|
740
|
+
const cursorY = item_15.p[1] + padding_1 + (line_0 + 1) * lineHeight_1;
|
|
741
|
+
ui_4.fillStyle = 'black';
|
|
742
|
+
ui_4.fillRect(cursorX, cursorY - lineHeight_1 + 3, 2, lineHeight_1 - 5);
|
|
743
|
+
};
|
|
744
|
+
const drawText = item_16 => {
|
|
745
|
+
const ui_5 = refs.ui.current.getContext('2d');
|
|
746
|
+
const zoom_0 = refs.scale.current;
|
|
747
|
+
const [x_4, y_4] = item_16.p;
|
|
748
|
+
const [width_0, height_1] = item_16.ar;
|
|
749
749
|
const {
|
|
750
|
-
lineHeight,
|
|
751
|
-
padding,
|
|
750
|
+
lineHeight: lineHeight_2,
|
|
751
|
+
padding: padding_2,
|
|
752
752
|
fillStyle
|
|
753
753
|
} = refs.textSettings.current;
|
|
754
|
-
const
|
|
754
|
+
const selected_1 = refs.tool.current === 'text' && item_16.se;
|
|
755
755
|
|
|
756
756
|
// Draw the box
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
757
|
+
ui_5.globalAlpha = 1;
|
|
758
|
+
ui_5.fillStyle = 'transparent';
|
|
759
|
+
ui_5.fillRect(x_4, y_4, width_0, height_1);
|
|
760
|
+
ui_5.lineWidth = 1 / zoom_0;
|
|
761
|
+
ui_5.strokeStyle = selected_1 ? colorSelect : 'transparent';
|
|
762
|
+
ui_5.strokeRect(x_4, y_4, width_0, height_1);
|
|
763
763
|
|
|
764
764
|
// Draw the text
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
765
|
+
ui_5.fillStyle = fillStyle || 'black';
|
|
766
|
+
ui_5.font = '16px Arial';
|
|
767
|
+
item_16.s.lines.forEach((line_1, index_0) => {
|
|
768
|
+
ui_5.fillText(line_1, x_4 + padding_2, y_4 + padding_2 + (index_0 + 1) * lineHeight_2 - 5);
|
|
769
769
|
});
|
|
770
|
-
if (
|
|
771
|
-
}
|
|
772
|
-
const drawSelect =
|
|
773
|
-
const
|
|
774
|
-
const [
|
|
775
|
-
const
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
}
|
|
784
|
-
const drawSelection =
|
|
785
|
-
const
|
|
786
|
-
const
|
|
770
|
+
if (selected_1) drawCursor(item_16);
|
|
771
|
+
};
|
|
772
|
+
const drawSelect = item_17 => {
|
|
773
|
+
const ui_6 = refs.ui.current.getContext('2d');
|
|
774
|
+
const [x_5, y_5, width_1, height_2] = item_17.c || [];
|
|
775
|
+
const path_1 = new Path2D();
|
|
776
|
+
path_1.rect(x_5, y_5, width_1, height_2);
|
|
777
|
+
ui_6.globalAlpha = 1;
|
|
778
|
+
ui_6.strokeStyle = colorSelect;
|
|
779
|
+
ui_6.lineCap = 'square';
|
|
780
|
+
ui_6.lineJoin = 'bevel';
|
|
781
|
+
ui_6.lineWidth = 1 / refs.scale.current;
|
|
782
|
+
ui_6.stroke(path_1);
|
|
783
|
+
};
|
|
784
|
+
const drawSelection = () => {
|
|
785
|
+
const ui_7 = refs.ui.current.getContext('2d');
|
|
786
|
+
const zoom_1 = refs.scale.current;
|
|
787
787
|
|
|
788
788
|
// canvas selection
|
|
789
|
-
const
|
|
790
|
-
if (
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
const
|
|
799
|
-
|
|
800
|
-
|
|
789
|
+
const select_0 = refs.select.current;
|
|
790
|
+
if (select_0) {
|
|
791
|
+
ui_7.globalAlpha = 1;
|
|
792
|
+
ui_7.globalCompositeOperation = 'source-over';
|
|
793
|
+
ui_7.lineWidth = 1 / zoom_1;
|
|
794
|
+
ui_7.lineCap = 'square';
|
|
795
|
+
ui_7.lineJoin = 'bevel';
|
|
796
|
+
ui_7.strokeStyle = colorSelect;
|
|
797
|
+
ui_7.fillStyle = colorSelectBackground;
|
|
798
|
+
const path_2 = getPath(select_0);
|
|
799
|
+
ui_7.fill(path_2);
|
|
800
|
+
ui_7.stroke(path_2);
|
|
801
801
|
}
|
|
802
|
-
}
|
|
803
|
-
const render =
|
|
804
|
-
const
|
|
805
|
-
const
|
|
802
|
+
};
|
|
803
|
+
const render = () => {
|
|
804
|
+
const ui_8 = refs.ui.current.getContext('2d');
|
|
805
|
+
const items_4 = refs.items.current.filter(Boolean);
|
|
806
806
|
|
|
807
807
|
// methods
|
|
808
|
-
|
|
809
|
-
|
|
808
|
+
ui_8.clearRect(0, 0, refs.ui.current.width, refs.ui.current.height);
|
|
809
|
+
ui_8.save();
|
|
810
810
|
|
|
811
811
|
// pan
|
|
812
|
-
|
|
812
|
+
ui_8.translate(refs.move.current.x, refs.move.current.y);
|
|
813
813
|
// zoom
|
|
814
|
-
|
|
814
|
+
ui_8.scale(refs.scale.current, refs.scale.current);
|
|
815
815
|
|
|
816
816
|
// grid
|
|
817
817
|
if (refs.grid.current) drawGrid();
|
|
818
818
|
|
|
819
819
|
// draw
|
|
820
|
-
|
|
820
|
+
items_4.forEach(item_18 => {
|
|
821
821
|
// image
|
|
822
|
-
if (
|
|
822
|
+
if (item_18.v === 'i' && item_18.ar.length === 2) drawImage(item_18);
|
|
823
823
|
// text
|
|
824
|
-
else if (
|
|
824
|
+
else if (item_18.v === 't') drawText(item_18);
|
|
825
825
|
// other
|
|
826
|
-
else draw(
|
|
826
|
+
else draw(item_18);
|
|
827
827
|
|
|
828
828
|
// select
|
|
829
|
-
if (
|
|
829
|
+
if (item_18.se) drawSelect(item_18);
|
|
830
830
|
});
|
|
831
831
|
|
|
832
832
|
// canvas selection
|
|
833
833
|
drawSelection();
|
|
834
|
-
|
|
835
|
-
}
|
|
834
|
+
ui_8.restore();
|
|
835
|
+
};
|
|
836
836
|
|
|
837
837
|
// Snap angle to nearest multiple of 15 degrees
|
|
838
|
-
const snapToAngle =
|
|
838
|
+
const snapToAngle = (dx, dy) => {
|
|
839
839
|
// Current angle in radians
|
|
840
|
-
const
|
|
840
|
+
const angle_0 = Math.atan2(dy, dx);
|
|
841
841
|
// Snap to nearest 15 degrees
|
|
842
|
-
const snappedAngle = Math.round(
|
|
842
|
+
const snappedAngle = Math.round(angle_0 / (Math.PI / 12)) * (Math.PI / 12);
|
|
843
843
|
// Length of the vector
|
|
844
844
|
const length = Math.sqrt(dx * dx + dy * dy);
|
|
845
845
|
return {
|
|
846
846
|
x: Math.cos(snappedAngle) * length,
|
|
847
847
|
y: Math.sin(snappedAngle) * length
|
|
848
848
|
};
|
|
849
|
-
}
|
|
850
|
-
const onMoveItems =
|
|
851
|
-
const
|
|
852
|
-
|
|
853
|
-
const
|
|
849
|
+
};
|
|
850
|
+
const onMoveItems = (x_6, y_6) => {
|
|
851
|
+
const itemsSelected_0 = getItems(true);
|
|
852
|
+
itemsSelected_0.forEach(item_19 => {
|
|
853
|
+
const v_2 = item_19.v;
|
|
854
854
|
|
|
855
855
|
// draw line
|
|
856
|
-
if (
|
|
857
|
-
|
|
858
|
-
return
|
|
856
|
+
if (v_2 === 'dl') {
|
|
857
|
+
item_19.p = item_19.p.map((value, index_1) => {
|
|
858
|
+
return index_1 % 2 ? value + y_6 : value + x_6;
|
|
859
859
|
});
|
|
860
860
|
}
|
|
861
861
|
|
|
862
862
|
// rectangle, draw point, object circle, ellipse, object line, object arrow, object triangle, image, text
|
|
863
|
-
if (['or', 'os', 'dp', 'oc', 'oe', 'ol', 'oa', 'ot', 'ote', 'i', 't'].includes(
|
|
864
|
-
|
|
865
|
-
|
|
863
|
+
if (['or', 'os', 'dp', 'oc', 'oe', 'ol', 'oa', 'ot', 'ote', 'i', 't'].includes(v_2)) {
|
|
864
|
+
item_19.p[0] += x_6;
|
|
865
|
+
item_19.p[1] += y_6;
|
|
866
866
|
}
|
|
867
867
|
|
|
868
868
|
// object line
|
|
869
|
-
if (['ol', 'oa'].includes(
|
|
870
|
-
|
|
871
|
-
|
|
869
|
+
if (['ol', 'oa'].includes(v_2)) {
|
|
870
|
+
item_19.ar[0] += x_6;
|
|
871
|
+
item_19.ar[1] += y_6;
|
|
872
872
|
}
|
|
873
873
|
|
|
874
874
|
// object triangle
|
|
875
|
-
if (['ot', 'ote'].includes(
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
875
|
+
if (['ot', 'ote'].includes(v_2)) {
|
|
876
|
+
item_19.p[2] += x_6;
|
|
877
|
+
item_19.p[4] += x_6;
|
|
878
|
+
item_19.p[3] += y_6;
|
|
879
|
+
item_19.p[5] += y_6;
|
|
880
880
|
}
|
|
881
881
|
});
|
|
882
882
|
onUpdateCoordinates();
|
|
883
|
-
}
|
|
884
|
-
const onMove =
|
|
883
|
+
};
|
|
884
|
+
const onMove = (body_0, event_4) => {
|
|
885
885
|
if (!refs.on.current) return;
|
|
886
886
|
const {
|
|
887
|
-
offsetX:
|
|
888
|
-
offsetY:
|
|
889
|
-
clientX,
|
|
890
|
-
clientY
|
|
891
|
-
} =
|
|
892
|
-
const xo = transform(
|
|
893
|
-
const yo = transform(
|
|
894
|
-
const
|
|
895
|
-
const
|
|
896
|
-
const currentX =
|
|
897
|
-
const currentY =
|
|
898
|
-
const
|
|
899
|
-
const
|
|
900
|
-
x: transform(
|
|
901
|
-
y: transform(
|
|
887
|
+
offsetX: x_7,
|
|
888
|
+
offsetY: y_7,
|
|
889
|
+
clientX: clientX_2,
|
|
890
|
+
clientY: clientY_2
|
|
891
|
+
} = body_0;
|
|
892
|
+
const xo = transform(x_7 - refs.move.current.x);
|
|
893
|
+
const yo = transform(y_7 - refs.move.current.y);
|
|
894
|
+
const ui_9 = refs.ui.current.getContext('2d');
|
|
895
|
+
const rect_1 = refs.ui.current.getBoundingClientRect();
|
|
896
|
+
const currentX = clientX_2 - rect_1.left;
|
|
897
|
+
const currentY = clientY_2 - rect_1.top;
|
|
898
|
+
const start_0 = refs.start.current;
|
|
899
|
+
const startTransformed_0 = {
|
|
900
|
+
x: transform(start_0.x - refs.move.current.x),
|
|
901
|
+
y: transform(start_0.y - refs.move.current.y)
|
|
902
902
|
};
|
|
903
|
-
const
|
|
904
|
-
const
|
|
905
|
-
const
|
|
906
|
-
const shiftKey =
|
|
907
|
-
const
|
|
903
|
+
const item_20 = getItem();
|
|
904
|
+
const items_5 = getItems();
|
|
905
|
+
const t_0 = refs.tool.current;
|
|
906
|
+
const shiftKey = event_4.shiftKey;
|
|
907
|
+
const zoom_2 = refs.scale.current;
|
|
908
908
|
refs.mouseMove.current.current = {
|
|
909
|
-
x:
|
|
910
|
-
y:
|
|
909
|
+
x: clientX_2 / zoom_2,
|
|
910
|
+
y: clientY_2 / zoom_2
|
|
911
911
|
};
|
|
912
912
|
refs.mouseMove.current.delta = {
|
|
913
913
|
x: refs.mouseMove.current.previous ? refs.mouseMove.current.current.x - refs.mouseMove.current.previous.x : 0,
|
|
@@ -917,137 +917,137 @@ const Whiteboard = /*#__PURE__*/React.forwardRef((props_, ref) => {
|
|
|
917
917
|
const delta = refs.mouseMove.current.delta;
|
|
918
918
|
|
|
919
919
|
// select
|
|
920
|
-
if (
|
|
920
|
+
if (t_0 === 'select') {
|
|
921
921
|
if (!refs.moveStarted.current) refs.moveStarted.current = true;
|
|
922
922
|
if (refs.select.current) {
|
|
923
923
|
unselectAll();
|
|
924
|
-
const
|
|
925
|
-
const
|
|
924
|
+
const width_2 = currentX - start_0.x;
|
|
925
|
+
const height_3 = currentY - start_0.y;
|
|
926
926
|
const isSquare = shiftKey;
|
|
927
927
|
const radius = 0;
|
|
928
928
|
if (isSquare) {
|
|
929
|
-
const side = Math.min(Math.abs(
|
|
929
|
+
const side = Math.min(Math.abs(width_2), Math.abs(height_3));
|
|
930
930
|
refs.select.current.v = 'os';
|
|
931
|
-
refs.select.current.p = [
|
|
932
|
-
refs.select.current.ar = [transform(Math.sign(
|
|
931
|
+
refs.select.current.p = [startTransformed_0.x, startTransformed_0.y];
|
|
932
|
+
refs.select.current.ar = [transform(Math.sign(width_2) * side), transform(Math.sign(height_3) * side), radius];
|
|
933
933
|
} else {
|
|
934
934
|
refs.select.current.v = 'or';
|
|
935
|
-
refs.select.current.p = [
|
|
936
|
-
refs.select.current.ar = [transform(
|
|
935
|
+
refs.select.current.p = [startTransformed_0.x, startTransformed_0.y];
|
|
936
|
+
refs.select.current.ar = [transform(width_2), transform(height_3), radius];
|
|
937
937
|
}
|
|
938
938
|
} else onMoveItems(delta.x, delta.y);
|
|
939
939
|
}
|
|
940
940
|
// pen
|
|
941
|
-
else if (
|
|
941
|
+
else if (t_0 === 'pen' && item_20) {
|
|
942
942
|
// same path from draw point, to move
|
|
943
943
|
if (!refs.moveStarted.current) {
|
|
944
|
-
|
|
944
|
+
item_20.v = 'dl';
|
|
945
945
|
refs.moveStarted.current = true;
|
|
946
946
|
}
|
|
947
947
|
|
|
948
948
|
// Add the current point to the path
|
|
949
|
-
|
|
949
|
+
item_20.p.push(xo, yo);
|
|
950
950
|
}
|
|
951
951
|
// pan
|
|
952
|
-
else if (
|
|
953
|
-
refs.move.current.x =
|
|
954
|
-
refs.move.current.y =
|
|
952
|
+
else if (t_0 === 'pan') {
|
|
953
|
+
refs.move.current.x = x_7 - refs.previous.current.x + refs.offset.current.x;
|
|
954
|
+
refs.move.current.y = y_7 - refs.previous.current.y + refs.offset.current.y;
|
|
955
955
|
}
|
|
956
956
|
// eraser
|
|
957
|
-
else if (
|
|
957
|
+
else if (t_0 === 'eraser') {
|
|
958
958
|
// find all items that x, y collides with, with certain radius
|
|
959
|
-
for (const
|
|
960
|
-
const isPointInStroke =
|
|
961
|
-
if (isPointInStroke) refs.remove.current.push(
|
|
959
|
+
for (const i_2 of items_5) {
|
|
960
|
+
const isPointInStroke = ui_9.isPointInStroke(getPath(i_2), xo, yo);
|
|
961
|
+
if (isPointInStroke) refs.remove.current.push(i_2);
|
|
962
962
|
}
|
|
963
963
|
}
|
|
964
964
|
// object line, object arrow
|
|
965
|
-
else if (['line', 'line-arrow'].includes(
|
|
965
|
+
else if (['line', 'line-arrow'].includes(t_0)) {
|
|
966
966
|
const snapAt15Degrees = shiftKey;
|
|
967
967
|
let endX = currentX;
|
|
968
968
|
let endY = currentY;
|
|
969
969
|
if (snapAt15Degrees) {
|
|
970
|
-
const snapped = snapToAngle(currentX -
|
|
971
|
-
endX =
|
|
972
|
-
endY =
|
|
970
|
+
const snapped = snapToAngle(currentX - start_0.x, currentY - start_0.y);
|
|
971
|
+
endX = start_0.x + snapped.x;
|
|
972
|
+
endY = start_0.y + snapped.y;
|
|
973
973
|
}
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
974
|
+
item_20.v = t_0 === 'line' ? 'ol' : 'oa';
|
|
975
|
+
item_20.p = [startTransformed_0.x, startTransformed_0.y];
|
|
976
|
+
item_20.ar = [transform(endX - refs.move.current.x), transform(endY - refs.move.current.y)];
|
|
977
977
|
}
|
|
978
978
|
// object circle
|
|
979
|
-
else if (
|
|
980
|
-
const
|
|
981
|
-
const
|
|
979
|
+
else if (t_0 === 'circle') {
|
|
980
|
+
const width_3 = currentX - start_0.x;
|
|
981
|
+
const height_4 = currentY - start_0.y;
|
|
982
982
|
const isCircle = shiftKey;
|
|
983
983
|
if (isCircle) {
|
|
984
|
-
const
|
|
985
|
-
const centerX =
|
|
986
|
-
const centerY =
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
984
|
+
const radius_0 = Math.min(Math.abs(width_3), Math.abs(height_4)) / 2;
|
|
985
|
+
const centerX = start_0.x + Math.sign(width_3) * radius_0;
|
|
986
|
+
const centerY = start_0.y + Math.sign(height_4) * radius_0;
|
|
987
|
+
item_20.v = 'oc';
|
|
988
|
+
item_20.p = [transform(centerX - refs.move.current.x), transform(centerY - refs.move.current.y)];
|
|
989
|
+
item_20.ar = [transform(radius_0), 0, Math.PI * 2];
|
|
990
990
|
} else {
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
991
|
+
item_20.v = 'oe';
|
|
992
|
+
item_20.p = [transform(start_0.x + width_3 / 2 - refs.move.current.x), transform(start_0.y + height_4 / 2 - refs.move.current.y)];
|
|
993
|
+
item_20.ar = [transform(Math.abs(width_3) / 2), transform(Math.abs(height_4) / 2), 0, 0, Math.PI * 2];
|
|
994
994
|
}
|
|
995
995
|
}
|
|
996
996
|
// object rectangle
|
|
997
|
-
else if (
|
|
998
|
-
const
|
|
999
|
-
const
|
|
1000
|
-
const
|
|
1001
|
-
const
|
|
1002
|
-
if (
|
|
1003
|
-
const
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
997
|
+
else if (t_0 === 'rectangle') {
|
|
998
|
+
const width_4 = currentX - start_0.x;
|
|
999
|
+
const height_5 = currentY - start_0.y;
|
|
1000
|
+
const isSquare_0 = shiftKey;
|
|
1001
|
+
const radius_1 = 0;
|
|
1002
|
+
if (isSquare_0) {
|
|
1003
|
+
const side_0 = Math.min(Math.abs(width_4), Math.abs(height_5));
|
|
1004
|
+
item_20.v = 'os';
|
|
1005
|
+
item_20.p = [startTransformed_0.x, startTransformed_0.y];
|
|
1006
|
+
item_20.ar = [transform(Math.sign(width_4) * side_0), transform(Math.sign(height_5) * side_0), radius_1];
|
|
1007
1007
|
} else {
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1008
|
+
item_20.v = 'or';
|
|
1009
|
+
item_20.p = [startTransformed_0.x, startTransformed_0.y];
|
|
1010
|
+
item_20.ar = [transform(width_4), transform(height_5), radius_1];
|
|
1011
1011
|
}
|
|
1012
1012
|
}
|
|
1013
1013
|
// object triangle
|
|
1014
|
-
else if (['triangle'].includes(
|
|
1015
|
-
const
|
|
1016
|
-
const
|
|
1017
|
-
const base = Math.abs(
|
|
1018
|
-
const
|
|
1019
|
-
const
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
height
|
|
1014
|
+
else if (['triangle'].includes(t_0)) {
|
|
1015
|
+
const endX_0 = xo;
|
|
1016
|
+
const endY_0 = yo;
|
|
1017
|
+
const base = Math.abs(endX_0 - startTransformed_0.x);
|
|
1018
|
+
const height_6 = shiftKey ? base * Math.sqrt(3) / 2 : Math.abs(endY_0 - startTransformed_0.y);
|
|
1019
|
+
const points_0 = [startTransformed_0.x, startTransformed_0.y, endX_0, startTransformed_0.y, startTransformed_0.x + (endX_0 - startTransformed_0.x) / 2, startTransformed_0.y - height_6];
|
|
1020
|
+
item_20.v = shiftKey ? 'ote' : 'ot';
|
|
1021
|
+
item_20.p = points_0;
|
|
1022
|
+
item_20.s = _objectSpread(_objectSpread({}, item_20.s), {}, {
|
|
1023
|
+
height: height_6
|
|
1024
1024
|
});
|
|
1025
1025
|
}
|
|
1026
1026
|
// image
|
|
1027
|
-
else if (
|
|
1028
|
-
const
|
|
1029
|
-
const
|
|
1027
|
+
else if (t_0 === 'image' && refs.image.current.complete && refs.image.current.src) {
|
|
1028
|
+
const width_5 = transform(currentX - start_0.x);
|
|
1029
|
+
const height_7 = transform(currentY - start_0.y);
|
|
1030
1030
|
const keepAspectRatio = !shiftKey;
|
|
1031
1031
|
let currentWidth;
|
|
1032
1032
|
let currentHeight;
|
|
1033
1033
|
if (keepAspectRatio) {
|
|
1034
|
-
if (Math.abs(
|
|
1035
|
-
currentWidth =
|
|
1036
|
-
currentHeight =
|
|
1034
|
+
if (Math.abs(width_5 / refs.aspectRatio.current) <= Math.abs(height_7)) {
|
|
1035
|
+
currentWidth = width_5;
|
|
1036
|
+
currentHeight = width_5 / refs.aspectRatio.current;
|
|
1037
1037
|
} else {
|
|
1038
|
-
currentWidth =
|
|
1039
|
-
currentHeight =
|
|
1038
|
+
currentWidth = height_7 * refs.aspectRatio.current;
|
|
1039
|
+
currentHeight = height_7;
|
|
1040
1040
|
}
|
|
1041
1041
|
} else {
|
|
1042
|
-
currentWidth =
|
|
1043
|
-
currentHeight =
|
|
1042
|
+
currentWidth = width_5;
|
|
1043
|
+
currentHeight = height_7;
|
|
1044
1044
|
}
|
|
1045
1045
|
if (keepAspectRatio) {
|
|
1046
|
-
if (
|
|
1047
|
-
if (
|
|
1046
|
+
if (width_5 < 0 && currentWidth > 0 || width_5 > 0 && currentWidth < 0) currentWidth *= -1;
|
|
1047
|
+
if (height_7 < 0 && currentHeight > 0 || height_7 > 0 && currentHeight < 0) currentHeight *= -1;
|
|
1048
1048
|
}
|
|
1049
|
-
|
|
1050
|
-
|
|
1049
|
+
item_20.p = [startTransformed_0.x, startTransformed_0.y];
|
|
1050
|
+
item_20.ar = [currentWidth, currentHeight];
|
|
1051
1051
|
}
|
|
1052
1052
|
|
|
1053
1053
|
// select box
|
|
@@ -1055,49 +1055,49 @@ const Whiteboard = /*#__PURE__*/React.forwardRef((props_, ref) => {
|
|
|
1055
1055
|
|
|
1056
1056
|
// render
|
|
1057
1057
|
render();
|
|
1058
|
-
}
|
|
1059
|
-
const onMouseMove =
|
|
1058
|
+
};
|
|
1059
|
+
const onMouseMove = event_5 => {
|
|
1060
1060
|
const {
|
|
1061
|
-
offsetX,
|
|
1062
|
-
offsetY,
|
|
1063
|
-
clientX,
|
|
1064
|
-
clientY
|
|
1065
|
-
} =
|
|
1061
|
+
offsetX: offsetX_2,
|
|
1062
|
+
offsetY: offsetY_2,
|
|
1063
|
+
clientX: clientX_3,
|
|
1064
|
+
clientY: clientY_3
|
|
1065
|
+
} = event_5;
|
|
1066
1066
|
onMove({
|
|
1067
|
-
offsetX,
|
|
1068
|
-
offsetY,
|
|
1069
|
-
clientX,
|
|
1070
|
-
clientY
|
|
1071
|
-
},
|
|
1072
|
-
}
|
|
1073
|
-
const onTouchMove =
|
|
1067
|
+
offsetX: offsetX_2,
|
|
1068
|
+
offsetY: offsetY_2,
|
|
1069
|
+
clientX: clientX_3,
|
|
1070
|
+
clientY: clientY_3
|
|
1071
|
+
}, event_5);
|
|
1072
|
+
};
|
|
1073
|
+
const onTouchMove = event_6 => {
|
|
1074
1074
|
// Get the first touch point
|
|
1075
|
-
const
|
|
1075
|
+
const touch_0 = event_6.touches[0];
|
|
1076
1076
|
const {
|
|
1077
|
-
clientX,
|
|
1078
|
-
clientY
|
|
1079
|
-
} =
|
|
1077
|
+
clientX: clientX_4,
|
|
1078
|
+
clientY: clientY_4
|
|
1079
|
+
} = touch_0;
|
|
1080
1080
|
let {
|
|
1081
|
-
offsetX,
|
|
1082
|
-
offsetY
|
|
1083
|
-
} =
|
|
1084
|
-
const
|
|
1085
|
-
if (
|
|
1081
|
+
offsetX: offsetX_3,
|
|
1082
|
+
offsetY: offsetY_3
|
|
1083
|
+
} = touch_0;
|
|
1084
|
+
const targetElement_0 = touch_0.target;
|
|
1085
|
+
if (targetElement_0 instanceof HTMLElement) {
|
|
1086
1086
|
// Get the bounding rectangle of the target element
|
|
1087
|
-
const
|
|
1087
|
+
const rect_2 = targetElement_0.getBoundingClientRect();
|
|
1088
1088
|
|
|
1089
1089
|
// Calculate the offsetX and offsetY
|
|
1090
|
-
|
|
1091
|
-
|
|
1090
|
+
offsetX_3 = touch_0.clientX - rect_2.left;
|
|
1091
|
+
offsetY_3 = touch_0.clientY - rect_2.top;
|
|
1092
1092
|
}
|
|
1093
1093
|
onMove({
|
|
1094
|
-
offsetX,
|
|
1095
|
-
offsetY,
|
|
1096
|
-
clientX,
|
|
1097
|
-
clientY
|
|
1098
|
-
},
|
|
1099
|
-
}
|
|
1100
|
-
const undo =
|
|
1094
|
+
offsetX: offsetX_3,
|
|
1095
|
+
offsetY: offsetY_3,
|
|
1096
|
+
clientX: clientX_4,
|
|
1097
|
+
clientY: clientY_4
|
|
1098
|
+
}, event_6);
|
|
1099
|
+
};
|
|
1100
|
+
const undo = () => {
|
|
1101
1101
|
if (!refs.undo.current.length) return;
|
|
1102
1102
|
|
|
1103
1103
|
// add current state to redo
|
|
@@ -1108,8 +1108,8 @@ const Whiteboard = /*#__PURE__*/React.forwardRef((props_, ref) => {
|
|
|
1108
1108
|
|
|
1109
1109
|
// render
|
|
1110
1110
|
render();
|
|
1111
|
-
}
|
|
1112
|
-
const redo =
|
|
1111
|
+
};
|
|
1112
|
+
const redo = () => {
|
|
1113
1113
|
if (!refs.redo.current.length) return;
|
|
1114
1114
|
|
|
1115
1115
|
// add current state to undo
|
|
@@ -1120,17 +1120,17 @@ const Whiteboard = /*#__PURE__*/React.forwardRef((props_, ref) => {
|
|
|
1120
1120
|
|
|
1121
1121
|
// render
|
|
1122
1122
|
render();
|
|
1123
|
-
}
|
|
1124
|
-
const onWheel =
|
|
1125
|
-
const
|
|
1123
|
+
};
|
|
1124
|
+
const onWheel = eventReact_1 => {
|
|
1125
|
+
const event_7 = eventReact_1.nativeEvent;
|
|
1126
1126
|
|
|
1127
1127
|
// zoom
|
|
1128
|
-
if (
|
|
1128
|
+
if (event_7.metaKey || event_7.ctrlKey) {
|
|
1129
1129
|
setTool('zoom');
|
|
1130
1130
|
refs.toolUpdateAuto.current = true;
|
|
1131
1131
|
const zoomFactor = 1.054;
|
|
1132
|
-
const mouseX =
|
|
1133
|
-
const mouseY =
|
|
1132
|
+
const mouseX = event_7.offsetX;
|
|
1133
|
+
const mouseY = event_7.offsetY;
|
|
1134
1134
|
const scale = refs.scale.current;
|
|
1135
1135
|
|
|
1136
1136
|
// Convert mouse position to canvas coordinates
|
|
@@ -1138,7 +1138,7 @@ const Whiteboard = /*#__PURE__*/React.forwardRef((props_, ref) => {
|
|
|
1138
1138
|
const canvasY = (mouseY - refs.move.current.y) / scale;
|
|
1139
1139
|
|
|
1140
1140
|
// Adjust scale
|
|
1141
|
-
const zoomIn =
|
|
1141
|
+
const zoomIn = event_7.deltaY < 0;
|
|
1142
1142
|
const newScale = zoomIn ? scale * zoomFactor : scale / zoomFactor;
|
|
1143
1143
|
if (newScale <= maxZoom / 100 && newScale >= minZoom / 100) {
|
|
1144
1144
|
// Update origin to focus on mouse position
|
|
@@ -1150,22 +1150,22 @@ const Whiteboard = /*#__PURE__*/React.forwardRef((props_, ref) => {
|
|
|
1150
1150
|
}
|
|
1151
1151
|
// pan
|
|
1152
1152
|
else if (!refs.mouseDown.current) {
|
|
1153
|
-
refs.move.current.x -=
|
|
1154
|
-
refs.move.current.y -=
|
|
1153
|
+
refs.move.current.x -= event_7.deltaX;
|
|
1154
|
+
refs.move.current.y -= event_7.deltaY;
|
|
1155
1155
|
render();
|
|
1156
1156
|
}
|
|
1157
|
-
}
|
|
1158
|
-
const onPaste =
|
|
1159
|
-
|
|
1157
|
+
};
|
|
1158
|
+
const onPaste = event_8 => {
|
|
1159
|
+
event_8.preventDefault();
|
|
1160
1160
|
|
|
1161
1161
|
// Get clipboard data
|
|
1162
|
-
const
|
|
1162
|
+
const items_6 = Array.from(event_8.clipboardData.items);
|
|
1163
1163
|
|
|
1164
1164
|
// Loop through clipboard items to find an image
|
|
1165
|
-
for (const
|
|
1166
|
-
if (
|
|
1165
|
+
for (const item_21 of items_6) {
|
|
1166
|
+
if (item_21.type.startsWith('image/')) {
|
|
1167
1167
|
// Get the image file
|
|
1168
|
-
const blob =
|
|
1168
|
+
const blob = item_21.getAsFile();
|
|
1169
1169
|
refs.image.current = new Image();
|
|
1170
1170
|
|
|
1171
1171
|
// Load the image and draw it on the canvas
|
|
@@ -1176,7 +1176,7 @@ const Whiteboard = /*#__PURE__*/React.forwardRef((props_, ref) => {
|
|
|
1176
1176
|
// 1) Upload the image first, than read it in image src
|
|
1177
1177
|
// 2) Add url of the image
|
|
1178
1178
|
// instead of embeding the image
|
|
1179
|
-
const
|
|
1179
|
+
const item__2 = {
|
|
1180
1180
|
i: getID(),
|
|
1181
1181
|
v: 'i',
|
|
1182
1182
|
p: [],
|
|
@@ -1189,7 +1189,7 @@ const Whiteboard = /*#__PURE__*/React.forwardRef((props_, ref) => {
|
|
|
1189
1189
|
},
|
|
1190
1190
|
a: OnesyDate.milliseconds
|
|
1191
1191
|
};
|
|
1192
|
-
add(
|
|
1192
|
+
add(item__2);
|
|
1193
1193
|
setTool('image');
|
|
1194
1194
|
};
|
|
1195
1195
|
|
|
@@ -1198,136 +1198,136 @@ const Whiteboard = /*#__PURE__*/React.forwardRef((props_, ref) => {
|
|
|
1198
1198
|
break;
|
|
1199
1199
|
}
|
|
1200
1200
|
}
|
|
1201
|
-
}
|
|
1201
|
+
};
|
|
1202
1202
|
React.useEffect(() => {
|
|
1203
1203
|
const method = () => {
|
|
1204
|
-
const
|
|
1205
|
-
const
|
|
1204
|
+
const width_6 = refs.root.current.offsetWidth;
|
|
1205
|
+
const height_8 = refs.root.current.offsetHeight;
|
|
1206
1206
|
setSize({
|
|
1207
|
-
width,
|
|
1208
|
-
height
|
|
1207
|
+
width: width_6,
|
|
1208
|
+
height: height_8
|
|
1209
1209
|
});
|
|
1210
1210
|
};
|
|
1211
|
-
const onKeyUp =
|
|
1211
|
+
const onKeyUp = event_9 => {
|
|
1212
1212
|
if (refs.toolUpdateAuto.current) setTool(refs.previousTool.current || 'pen');
|
|
1213
1213
|
};
|
|
1214
|
-
const onKeyDown = async
|
|
1214
|
+
const onKeyDown = async event_10 => {
|
|
1215
1215
|
refs.toolUpdateAuto.current = false;
|
|
1216
1216
|
const {
|
|
1217
|
-
key
|
|
1218
|
-
} =
|
|
1217
|
+
key: key_0
|
|
1218
|
+
} = event_10;
|
|
1219
1219
|
const itemsAll = [...refs.items.current].filter(Boolean);
|
|
1220
|
-
const
|
|
1221
|
-
const
|
|
1222
|
-
if (['a', 'A'].includes(
|
|
1223
|
-
|
|
1220
|
+
const t_1 = refs.tool.current;
|
|
1221
|
+
const zoom_3 = refs.scale.current;
|
|
1222
|
+
if (['a', 'A'].includes(key_0) && (event_10.metaKey || event_10.ctrlKey)) {
|
|
1223
|
+
event_10.preventDefault();
|
|
1224
1224
|
selectAll();
|
|
1225
1225
|
render();
|
|
1226
|
-
} else if (
|
|
1227
|
-
const
|
|
1228
|
-
if (
|
|
1229
|
-
if (
|
|
1230
|
-
if (
|
|
1231
|
-
if (
|
|
1232
|
-
if (
|
|
1233
|
-
const
|
|
1234
|
-
refs.items.current.forEach(
|
|
1235
|
-
if (
|
|
1226
|
+
} else if (t_1 === 'select' && ['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight', 'Backspace'].includes(key_0)) {
|
|
1227
|
+
const value_0 = event_10.shiftKey ? 10 : 1;
|
|
1228
|
+
if (key_0 === 'ArrowUp') onMoveItems(0, -value_0 / zoom_3);
|
|
1229
|
+
if (key_0 === 'ArrowDown') onMoveItems(0, value_0 / zoom_3);
|
|
1230
|
+
if (key_0 === 'ArrowLeft') onMoveItems(-value_0 / zoom_3, 0);
|
|
1231
|
+
if (key_0 === 'ArrowRight') onMoveItems(value_0 / zoom_3, 0);
|
|
1232
|
+
if (key_0 === 'Backspace') {
|
|
1233
|
+
const toRemove_2 = [];
|
|
1234
|
+
refs.items.current.forEach(item_22 => {
|
|
1235
|
+
if (item_22.se) toRemove_2.push(item_22);
|
|
1236
1236
|
});
|
|
1237
|
-
if (
|
|
1237
|
+
if (toRemove_2.length) remove(toRemove_2);
|
|
1238
1238
|
}
|
|
1239
1239
|
render();
|
|
1240
|
-
} else if (
|
|
1240
|
+
} else if (key_0 === 'Escape') {
|
|
1241
1241
|
setTool('select');
|
|
1242
1242
|
refs.textActive.current = null;
|
|
1243
1243
|
unselectAll();
|
|
1244
1244
|
filterItems();
|
|
1245
1245
|
render();
|
|
1246
1246
|
} else if (tool === 'text') {
|
|
1247
|
-
const selectedTextBox = itemsAll.find(
|
|
1247
|
+
const selectedTextBox = itemsAll.find(item_23 => item_23.v === 't' && item_23.se);
|
|
1248
1248
|
if (!selectedTextBox) return;
|
|
1249
1249
|
const {
|
|
1250
|
-
line,
|
|
1251
|
-
char
|
|
1250
|
+
line: line_2,
|
|
1251
|
+
char: char_0
|
|
1252
1252
|
} = selectedTextBox.s.cursor;
|
|
1253
|
-
const
|
|
1254
|
-
const
|
|
1255
|
-
if (['ArrowLeft', 'ArrowRight'].includes(
|
|
1256
|
-
|
|
1257
|
-
selectedTextBox.s.cursor.char +=
|
|
1253
|
+
const lines_0 = selectedTextBox.s.lines;
|
|
1254
|
+
const currentLine_0 = lines_0[line_2];
|
|
1255
|
+
if (['ArrowLeft', 'ArrowRight'].includes(key_0)) {
|
|
1256
|
+
event_10.preventDefault();
|
|
1257
|
+
selectedTextBox.s.cursor.char += key_0 === 'ArrowLeft' ? -1 : 1;
|
|
1258
1258
|
if (selectedTextBox.s.cursor.char < 0) {
|
|
1259
1259
|
selectedTextBox.s.cursor.line--;
|
|
1260
|
-
selectedTextBox.s.cursor.char =
|
|
1261
|
-
} else if (selectedTextBox.s.cursor.char >
|
|
1260
|
+
selectedTextBox.s.cursor.char = lines_0[selectedTextBox.s.cursor.line]?.length;
|
|
1261
|
+
} else if (selectedTextBox.s.cursor.char > lines_0[line_2]?.length && line_2 !== lines_0.length - 1) {
|
|
1262
1262
|
selectedTextBox.s.cursor.line++;
|
|
1263
1263
|
selectedTextBox.s.cursor.char = 0;
|
|
1264
1264
|
}
|
|
1265
|
-
selectedTextBox.s.cursor.line = clamp(selectedTextBox.s.cursor.line, 0,
|
|
1266
|
-
selectedTextBox.s.cursor.char = clamp(selectedTextBox.s.cursor.char, 0,
|
|
1265
|
+
selectedTextBox.s.cursor.line = clamp(selectedTextBox.s.cursor.line, 0, lines_0.length - 1);
|
|
1266
|
+
selectedTextBox.s.cursor.char = clamp(selectedTextBox.s.cursor.char, 0, lines_0[selectedTextBox.s.cursor.line]?.length);
|
|
1267
1267
|
}
|
|
1268
|
-
if (['ArrowUp', 'ArrowDown'].includes(
|
|
1269
|
-
|
|
1270
|
-
selectedTextBox.s.cursor.line +=
|
|
1271
|
-
selectedTextBox.s.cursor.line = clamp(selectedTextBox.s.cursor.line, 0,
|
|
1272
|
-
selectedTextBox.s.cursor.char = clamp(selectedTextBox.s.cursor.char, 0,
|
|
1273
|
-
} else if (
|
|
1274
|
-
|
|
1275
|
-
const newLine =
|
|
1276
|
-
|
|
1277
|
-
|
|
1268
|
+
if (['ArrowUp', 'ArrowDown'].includes(key_0)) {
|
|
1269
|
+
event_10.preventDefault();
|
|
1270
|
+
selectedTextBox.s.cursor.line += key_0 === 'ArrowUp' ? -1 : 1;
|
|
1271
|
+
selectedTextBox.s.cursor.line = clamp(selectedTextBox.s.cursor.line, 0, lines_0.length - 1);
|
|
1272
|
+
selectedTextBox.s.cursor.char = clamp(selectedTextBox.s.cursor.char, 0, lines_0[selectedTextBox.s.cursor.line]?.length);
|
|
1273
|
+
} else if (key_0 === 'Enter') {
|
|
1274
|
+
event_10.preventDefault();
|
|
1275
|
+
const newLine = currentLine_0.slice(char_0);
|
|
1276
|
+
lines_0[line_2] = currentLine_0.slice(0, char_0);
|
|
1277
|
+
lines_0.splice(line_2 + 1, 0, newLine);
|
|
1278
1278
|
selectedTextBox.s.cursor.line++;
|
|
1279
1279
|
selectedTextBox.s.cursor.char = 0;
|
|
1280
|
-
} else if (
|
|
1281
|
-
|
|
1282
|
-
if (
|
|
1283
|
-
|
|
1280
|
+
} else if (key_0 === 'Backspace') {
|
|
1281
|
+
event_10.preventDefault();
|
|
1282
|
+
if (char_0 > 0) {
|
|
1283
|
+
lines_0[line_2] = currentLine_0.slice(0, char_0 - 1) + currentLine_0.slice(char_0);
|
|
1284
1284
|
selectedTextBox.s.cursor.char--;
|
|
1285
|
-
} else if (
|
|
1286
|
-
const prevLine =
|
|
1285
|
+
} else if (line_2 > 0) {
|
|
1286
|
+
const prevLine = lines_0[line_2 - 1];
|
|
1287
1287
|
selectedTextBox.s.cursor.char = prevLine.length;
|
|
1288
|
-
|
|
1289
|
-
|
|
1288
|
+
lines_0[line_2 - 1] += lines_0[line_2];
|
|
1289
|
+
lines_0.splice(line_2, 1);
|
|
1290
1290
|
selectedTextBox.s.cursor.line--;
|
|
1291
1291
|
}
|
|
1292
|
-
} else if (
|
|
1293
|
-
if ([' '].includes(
|
|
1292
|
+
} else if (key_0.length === 1) {
|
|
1293
|
+
if ([' '].includes(key_0)) event_10.preventDefault();
|
|
1294
1294
|
let textClipboard = '';
|
|
1295
|
-
const isPaste = (
|
|
1295
|
+
const isPaste = (event_10.ctrlKey || event_10.metaKey) && ['v', 'V'].includes(key_0);
|
|
1296
1296
|
if (isPaste) {
|
|
1297
1297
|
try {
|
|
1298
1298
|
textClipboard = await window.navigator.clipboard.readText();
|
|
1299
1299
|
} catch (error) {}
|
|
1300
1300
|
}
|
|
1301
|
-
const text = isPaste ? textClipboard :
|
|
1302
|
-
selectedTextBox.s.lines[
|
|
1301
|
+
const text = isPaste ? textClipboard : key_0;
|
|
1302
|
+
selectedTextBox.s.lines[line_2] = currentLine_0.slice(0, char_0) + text + currentLine_0.slice(char_0);
|
|
1303
1303
|
selectedTextBox.s.cursor.char += text.length;
|
|
1304
1304
|
}
|
|
1305
1305
|
updateTextBoxDimensions(selectedTextBox);
|
|
1306
1306
|
selectedTextBox.c = [...selectedTextBox.p, ...selectedTextBox.ar];
|
|
1307
1307
|
render();
|
|
1308
1308
|
} else {
|
|
1309
|
-
if (
|
|
1310
|
-
if (
|
|
1309
|
+
if (event_10.metaKey && key_0 === 'z') {
|
|
1310
|
+
if (event_10.shiftKey) redo();else undo();
|
|
1311
1311
|
}
|
|
1312
|
-
if (
|
|
1312
|
+
if (key_0 === ' ') {
|
|
1313
1313
|
refs.toolUpdateAuto.current = true;
|
|
1314
1314
|
setTool('pan');
|
|
1315
1315
|
}
|
|
1316
1316
|
|
|
1317
1317
|
// tools
|
|
1318
|
-
if (
|
|
1319
|
-
if (['E', 'D', 'P', 'S', 'C', 'R', 'I', 'L', 'A', 'T', 'G'].includes(
|
|
1320
|
-
if (
|
|
1321
|
-
if (
|
|
1322
|
-
if (
|
|
1323
|
-
if (
|
|
1324
|
-
if (
|
|
1325
|
-
if (
|
|
1326
|
-
if (
|
|
1327
|
-
if (
|
|
1328
|
-
if (
|
|
1329
|
-
if (
|
|
1330
|
-
if (
|
|
1318
|
+
if (event_10.shiftKey) {
|
|
1319
|
+
if (['E', 'D', 'P', 'S', 'C', 'R', 'I', 'L', 'A', 'T', 'G'].includes(key_0)) refs.toolUpdateAuto.current = false;
|
|
1320
|
+
if (key_0 === 'E') setTool('eraser');
|
|
1321
|
+
if (key_0 === 'D') setTool('pen');
|
|
1322
|
+
if (key_0 === 'P') setTool('pan');
|
|
1323
|
+
if (key_0 === 'S') setTool('select');
|
|
1324
|
+
if (key_0 === 'C') setTool('circle');
|
|
1325
|
+
if (key_0 === 'R') setTool('rectangle');
|
|
1326
|
+
if (key_0 === 'I') setTool('triangle');
|
|
1327
|
+
if (key_0 === 'L') setTool('line');
|
|
1328
|
+
if (key_0 === 'A') setTool('line-arrow');
|
|
1329
|
+
if (key_0 === 'T') setTool('text');
|
|
1330
|
+
if (key_0 === 'G') {
|
|
1331
1331
|
setGrid(previous => !previous);
|
|
1332
1332
|
render();
|
|
1333
1333
|
}
|
|
@@ -1355,20 +1355,20 @@ const Whiteboard = /*#__PURE__*/React.forwardRef((props_, ref) => {
|
|
|
1355
1355
|
window.document.removeEventListener('paste', onPaste);
|
|
1356
1356
|
};
|
|
1357
1357
|
}, []);
|
|
1358
|
-
const onChangeInputFile =
|
|
1359
|
-
const file =
|
|
1358
|
+
const onChangeInputFile = event_11 => {
|
|
1359
|
+
const file = event_11.target.files[0];
|
|
1360
1360
|
if (file) {
|
|
1361
1361
|
const reader = new FileReader();
|
|
1362
1362
|
reader.onload = eventReader => {
|
|
1363
1363
|
refs.image.current = new Image();
|
|
1364
1364
|
refs.image.current.src = eventReader.target.result;
|
|
1365
1365
|
refs.toolUpdateAuto.current = true;
|
|
1366
|
-
|
|
1366
|
+
event_11.target.value = '';
|
|
1367
1367
|
setTool('image');
|
|
1368
1368
|
};
|
|
1369
1369
|
reader.readAsDataURL(file);
|
|
1370
1370
|
}
|
|
1371
|
-
}
|
|
1371
|
+
};
|
|
1372
1372
|
const propsCanvas = {
|
|
1373
1373
|
width: size.width,
|
|
1374
1374
|
height: size.height,
|
|
@@ -1379,11 +1379,11 @@ const Whiteboard = /*#__PURE__*/React.forwardRef((props_, ref) => {
|
|
|
1379
1379
|
}
|
|
1380
1380
|
};
|
|
1381
1381
|
return /*#__PURE__*/React.createElement(Line, _extends({
|
|
1382
|
-
ref:
|
|
1382
|
+
ref: item_24 => {
|
|
1383
1383
|
if (ref) {
|
|
1384
|
-
if (is('function', ref)) ref(
|
|
1384
|
+
if (is('function', ref)) ref(item_24);else ref.current = item_24;
|
|
1385
1385
|
}
|
|
1386
|
-
refs.root.current =
|
|
1386
|
+
refs.root.current = item_24;
|
|
1387
1387
|
},
|
|
1388
1388
|
flex: true,
|
|
1389
1389
|
fullWidth: true,
|