@onesy/ui-react 1.0.164 → 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 +133 -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 +132 -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
package/Whiteboard/Whiteboard.js
CHANGED
|
@@ -70,15 +70,10 @@ const useStyle = (0, _styleReact.style)(theme => ({
|
|
|
70
70
|
const colorSelect = 'hsl(244deg 64% 64%)';
|
|
71
71
|
const colorSelectBackground = 'hsla(244deg 64% 64% / 4%)';
|
|
72
72
|
const Whiteboard = /*#__PURE__*/_react.default.forwardRef((props_, ref) => {
|
|
73
|
+
var _theme$ui, _theme$ui2, _theme$elements;
|
|
73
74
|
const theme = (0, _styleReact.useOnesyTheme)();
|
|
74
|
-
const props =
|
|
75
|
-
|
|
76
|
-
return _objectSpread(_objectSpread(_objectSpread({}, theme === null || theme === void 0 || (_theme$ui = theme.ui) === null || _theme$ui === void 0 || (_theme$ui = _theme$ui.elements) === null || _theme$ui === void 0 || (_theme$ui = _theme$ui.all) === null || _theme$ui === void 0 || (_theme$ui = _theme$ui.props) === null || _theme$ui === void 0 ? void 0 : _theme$ui.default), theme === null || theme === void 0 || (_theme$ui2 = theme.ui) === null || _theme$ui2 === void 0 || (_theme$ui2 = _theme$ui2.elements) === null || _theme$ui2 === void 0 || (_theme$ui2 = _theme$ui2.onesyWhiteboard) === null || _theme$ui2 === void 0 || (_theme$ui2 = _theme$ui2.props) === null || _theme$ui2 === void 0 ? void 0 : _theme$ui2.default), props_);
|
|
77
|
-
}, [props_]);
|
|
78
|
-
const Line = _react.default.useMemo(() => {
|
|
79
|
-
var _theme$elements;
|
|
80
|
-
return (theme === null || theme === void 0 || (_theme$elements = theme.elements) === null || _theme$elements === void 0 ? void 0 : _theme$elements.Line) || _Line.default;
|
|
81
|
-
}, [theme]);
|
|
75
|
+
const props = _objectSpread(_objectSpread(_objectSpread({}, theme === null || theme === void 0 || (_theme$ui = theme.ui) === null || _theme$ui === void 0 || (_theme$ui = _theme$ui.elements) === null || _theme$ui === void 0 || (_theme$ui = _theme$ui.all) === null || _theme$ui === void 0 || (_theme$ui = _theme$ui.props) === null || _theme$ui === void 0 ? void 0 : _theme$ui.default), theme === null || theme === void 0 || (_theme$ui2 = theme.ui) === null || _theme$ui2 === void 0 || (_theme$ui2 = _theme$ui2.elements) === null || _theme$ui2 === void 0 || (_theme$ui2 = _theme$ui2.onesyWhiteboard) === null || _theme$ui2 === void 0 || (_theme$ui2 = _theme$ui2.props) === null || _theme$ui2 === void 0 ? void 0 : _theme$ui2.default), props_);
|
|
76
|
+
const Line = (theme === null || theme === void 0 || (_theme$elements = theme.elements) === null || _theme$elements === void 0 ? void 0 : _theme$elements.Line) || _Line.default;
|
|
82
77
|
const {
|
|
83
78
|
valueDefault,
|
|
84
79
|
onChange: onChangeProps,
|
|
@@ -171,7 +166,7 @@ const Whiteboard = /*#__PURE__*/_react.default.forwardRef((props_, ref) => {
|
|
|
171
166
|
refs.mouseDown.current = mouseDown;
|
|
172
167
|
refs.tool.current = tool;
|
|
173
168
|
refs.grid.current = grid;
|
|
174
|
-
const init =
|
|
169
|
+
const init = () => {
|
|
175
170
|
// Todo
|
|
176
171
|
// items
|
|
177
172
|
// load all of the images in memory and attach theme to items as image elements
|
|
@@ -181,25 +176,25 @@ const Whiteboard = /*#__PURE__*/_react.default.forwardRef((props_, ref) => {
|
|
|
181
176
|
render();
|
|
182
177
|
setLoaded(true);
|
|
183
178
|
}, 40);
|
|
184
|
-
}
|
|
179
|
+
};
|
|
185
180
|
_react.default.useEffect(() => {
|
|
186
181
|
if (!['zoom'].includes(tool)) refs.previousTool.current = tool;
|
|
187
182
|
}, [tool]);
|
|
188
|
-
const onChange =
|
|
183
|
+
const onChange = () => {
|
|
189
184
|
if ((0, _utils.is)('function', onChangeProps)) onChangeProps(refs.items.current);
|
|
190
|
-
}
|
|
191
|
-
const getItems =
|
|
192
|
-
const getItem =
|
|
193
|
-
const filterItems =
|
|
194
|
-
const toRemove = refs.items.current.filter(
|
|
195
|
-
var
|
|
196
|
-
if (refs.tool.current === 'text' &&
|
|
197
|
-
const lines = ((
|
|
198
|
-
return !(
|
|
185
|
+
};
|
|
186
|
+
const getItems = (selected = undefined) => refs.items.current.filter(item => selected === undefined || item.se === selected);
|
|
187
|
+
const getItem = () => refs.items.current[refs.items.current.length - 1];
|
|
188
|
+
const filterItems = () => {
|
|
189
|
+
const toRemove = refs.items.current.filter(item_0 => {
|
|
190
|
+
var _item_0$s;
|
|
191
|
+
if (refs.tool.current === 'text' && item_0 !== refs.textActive.current) item_0.se = false;
|
|
192
|
+
const lines = ((_item_0$s = item_0.s) === null || _item_0$s === void 0 ? void 0 : _item_0$s.lines) || [];
|
|
193
|
+
return !(item_0.v !== 't' || item_0 === refs.textActive.current || lines.length > 1 || lines[0].length);
|
|
199
194
|
});
|
|
200
195
|
if (toRemove.length) remove(toRemove);
|
|
201
|
-
}
|
|
202
|
-
const add =
|
|
196
|
+
};
|
|
197
|
+
const add = toAdd => {
|
|
203
198
|
const itemsAdd = (Array.isArray(toAdd) ? toAdd : [toAdd]).filter(Boolean);
|
|
204
199
|
const items = getItems();
|
|
205
200
|
|
|
@@ -209,22 +204,22 @@ const Whiteboard = /*#__PURE__*/_react.default.forwardRef((props_, ref) => {
|
|
|
209
204
|
// clear redo stack
|
|
210
205
|
refs.redo.current = [];
|
|
211
206
|
refs.items.current.push(...itemsAdd);
|
|
212
|
-
}
|
|
213
|
-
const remove =
|
|
214
|
-
const itemsRemove = (Array.isArray(
|
|
215
|
-
const
|
|
216
|
-
const IDs = itemsRemove === null || itemsRemove === void 0 ? void 0 : itemsRemove.map(
|
|
217
|
-
const toRemoveIDs =
|
|
207
|
+
};
|
|
208
|
+
const remove = toRemove_0 => {
|
|
209
|
+
const itemsRemove = (Array.isArray(toRemove_0) ? toRemove_0 : [toRemove_0]).filter(Boolean);
|
|
210
|
+
const items_0 = getItems();
|
|
211
|
+
const IDs = itemsRemove === null || itemsRemove === void 0 ? void 0 : itemsRemove.map(item_1 => item_1.i);
|
|
212
|
+
const toRemoveIDs = items_0.filter(item_2 => IDs.includes(item_2.i)).map(item_3 => item_3.i);
|
|
218
213
|
if (!toRemoveIDs) return;
|
|
219
214
|
|
|
220
215
|
// add to undo stack snapshot of current state
|
|
221
|
-
refs.undo.current.push([...
|
|
216
|
+
refs.undo.current.push([...items_0]);
|
|
222
217
|
|
|
223
218
|
// clear redo stack
|
|
224
219
|
refs.redo.current = [];
|
|
225
|
-
refs.items.current = refs.items.current.filter(
|
|
226
|
-
}
|
|
227
|
-
const reset =
|
|
220
|
+
refs.items.current = refs.items.current.filter(item_4 => !toRemoveIDs.includes(item_4.i));
|
|
221
|
+
};
|
|
222
|
+
const reset = () => {
|
|
228
223
|
refs.on.current = false;
|
|
229
224
|
refs.moveStarted.current = false;
|
|
230
225
|
refs.image.current = null;
|
|
@@ -232,25 +227,25 @@ const Whiteboard = /*#__PURE__*/_react.default.forwardRef((props_, ref) => {
|
|
|
232
227
|
// new move start
|
|
233
228
|
refs.offset.current.x = refs.move.current.x;
|
|
234
229
|
refs.offset.current.y = refs.move.current.y;
|
|
235
|
-
}
|
|
236
|
-
const transform =
|
|
237
|
-
const selectAll =
|
|
238
|
-
return [...refs.items.current].filter(Boolean).map(
|
|
239
|
-
|
|
240
|
-
return
|
|
230
|
+
};
|
|
231
|
+
const transform = coordinate => coordinate / refs.scale.current;
|
|
232
|
+
const selectAll = () => {
|
|
233
|
+
return [...refs.items.current].filter(Boolean).map(item_5 => {
|
|
234
|
+
item_5.se = true;
|
|
235
|
+
return item_5;
|
|
241
236
|
});
|
|
242
|
-
}
|
|
243
|
-
const unselectAll =
|
|
237
|
+
};
|
|
238
|
+
const unselectAll = eventReact => {
|
|
244
239
|
const event = (eventReact === null || eventReact === void 0 ? void 0 : eventReact.nativeEvent) || eventReact;
|
|
245
240
|
const shift = event === null || event === void 0 ? void 0 : event.shiftKey;
|
|
246
|
-
return [...refs.items.current].filter(Boolean).map(
|
|
247
|
-
if (shift) return
|
|
248
|
-
|
|
249
|
-
return
|
|
241
|
+
return [...refs.items.current].filter(Boolean).map(item_6 => {
|
|
242
|
+
if (shift) return item_6;
|
|
243
|
+
item_6.se = false;
|
|
244
|
+
return item_6;
|
|
250
245
|
});
|
|
251
|
-
}
|
|
252
|
-
const onInteractionDown =
|
|
253
|
-
const
|
|
246
|
+
};
|
|
247
|
+
const onInteractionDown = (body, eventReact_0) => {
|
|
248
|
+
const event_0 = (eventReact_0 === null || eventReact_0 === void 0 ? void 0 : eventReact_0.nativeEvent) || eventReact_0;
|
|
254
249
|
const {
|
|
255
250
|
offsetX: x,
|
|
256
251
|
offsetY: y,
|
|
@@ -273,7 +268,7 @@ const Whiteboard = /*#__PURE__*/_react.default.forwardRef((props_, ref) => {
|
|
|
273
268
|
y: 0
|
|
274
269
|
}
|
|
275
270
|
};
|
|
276
|
-
const
|
|
271
|
+
const shift_0 = event_0 === null || event_0 === void 0 ? void 0 : event_0.shiftKey;
|
|
277
272
|
const ui = refs.ui.current.getContext('2d');
|
|
278
273
|
const rect = refs.ui.current.getBoundingClientRect();
|
|
279
274
|
refs.start.current.x = clientX - rect.left;
|
|
@@ -285,15 +280,15 @@ const Whiteboard = /*#__PURE__*/_react.default.forwardRef((props_, ref) => {
|
|
|
285
280
|
y: transform(start.y - refs.move.current.y)
|
|
286
281
|
};
|
|
287
282
|
Object.keys(settings).forEach(item_ => ui[item_] = settings[item_]);
|
|
288
|
-
let
|
|
289
|
-
const
|
|
283
|
+
let item_7;
|
|
284
|
+
const items_1 = getItems();
|
|
290
285
|
const t = refs.tool.current;
|
|
291
286
|
refs.select.current = null;
|
|
292
287
|
if (t === 'select') {
|
|
293
288
|
// z-index top to bottom order
|
|
294
|
-
const itemsReversed = [...
|
|
295
|
-
const itemsClicked = itemsReversed.filter(
|
|
296
|
-
return
|
|
289
|
+
const itemsReversed = [...items_1].reverse();
|
|
290
|
+
const itemsClicked = itemsReversed.filter(item__0 => {
|
|
291
|
+
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];
|
|
297
292
|
});
|
|
298
293
|
const itemsSelected = getItems(true);
|
|
299
294
|
const clicked = itemsClicked[0];
|
|
@@ -304,16 +299,16 @@ const Whiteboard = /*#__PURE__*/_react.default.forwardRef((props_, ref) => {
|
|
|
304
299
|
ar: []
|
|
305
300
|
};
|
|
306
301
|
}
|
|
307
|
-
if (!
|
|
302
|
+
if (!shift_0 && !(clicked !== null && clicked !== void 0 && clicked.se && itemsSelected.length > 1)) unselectAll();
|
|
308
303
|
if (clicked) {
|
|
309
|
-
clicked.se =
|
|
304
|
+
clicked.se = shift_0 ? !clicked.se : true;
|
|
310
305
|
}
|
|
311
306
|
} else if (t === 'text') {
|
|
312
307
|
const {
|
|
313
308
|
lineHeight,
|
|
314
309
|
padding
|
|
315
310
|
} = refs.textSettings.current;
|
|
316
|
-
const selectedText =
|
|
311
|
+
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]);
|
|
317
312
|
if (selectedText) {
|
|
318
313
|
var _selectedText$s;
|
|
319
314
|
refs.textActive.current = selectedText;
|
|
@@ -334,7 +329,7 @@ const Whiteboard = /*#__PURE__*/_react.default.forwardRef((props_, ref) => {
|
|
|
334
329
|
char: charIndex
|
|
335
330
|
};
|
|
336
331
|
} else {
|
|
337
|
-
|
|
332
|
+
item_7 = {
|
|
338
333
|
i: (0, _utils.getID)(),
|
|
339
334
|
v: 't',
|
|
340
335
|
p: [startTransformed.x, startTransformed.y],
|
|
@@ -349,13 +344,13 @@ const Whiteboard = /*#__PURE__*/_react.default.forwardRef((props_, ref) => {
|
|
|
349
344
|
se: true,
|
|
350
345
|
a: _date.OnesyDate.milliseconds
|
|
351
346
|
};
|
|
352
|
-
refs.textActive.current =
|
|
347
|
+
refs.textActive.current = item_7;
|
|
353
348
|
}
|
|
354
349
|
} else {
|
|
355
350
|
// pen
|
|
356
351
|
if (t === 'pen') {
|
|
357
352
|
// point
|
|
358
|
-
|
|
353
|
+
item_7 = {
|
|
359
354
|
i: (0, _utils.getID)(),
|
|
360
355
|
v: 'dp',
|
|
361
356
|
p: [transform(x - refs.move.current.x), transform(y - refs.move.current.y)],
|
|
@@ -366,7 +361,7 @@ const Whiteboard = /*#__PURE__*/_react.default.forwardRef((props_, ref) => {
|
|
|
366
361
|
}
|
|
367
362
|
// circle, rectangle, line, line-arrow
|
|
368
363
|
if (['circle', 'rectangle', 'triangle', 'line', 'line-arrow'].includes(t)) {
|
|
369
|
-
|
|
364
|
+
item_7 = {
|
|
370
365
|
i: (0, _utils.getID)(),
|
|
371
366
|
p: [],
|
|
372
367
|
ar: [],
|
|
@@ -387,7 +382,7 @@ const Whiteboard = /*#__PURE__*/_react.default.forwardRef((props_, ref) => {
|
|
|
387
382
|
// Todo
|
|
388
383
|
// add url of the image
|
|
389
384
|
// instead of embeding the image
|
|
390
|
-
|
|
385
|
+
item_7 = {
|
|
391
386
|
i: (0, _utils.getID)(),
|
|
392
387
|
v: 'i',
|
|
393
388
|
p: [],
|
|
@@ -402,116 +397,116 @@ const Whiteboard = /*#__PURE__*/_react.default.forwardRef((props_, ref) => {
|
|
|
402
397
|
};
|
|
403
398
|
}
|
|
404
399
|
}
|
|
405
|
-
if (
|
|
400
|
+
if (item_7) add(item_7);
|
|
406
401
|
filterItems();
|
|
407
402
|
|
|
408
403
|
// render
|
|
409
404
|
render();
|
|
410
405
|
setMouseDown(true);
|
|
411
|
-
}
|
|
412
|
-
const onMouseDown =
|
|
406
|
+
};
|
|
407
|
+
const onMouseDown = event_1 => {
|
|
413
408
|
const {
|
|
414
409
|
offsetX,
|
|
415
410
|
offsetY,
|
|
416
|
-
clientX,
|
|
417
|
-
clientY
|
|
418
|
-
} =
|
|
411
|
+
clientX: clientX_0,
|
|
412
|
+
clientY: clientY_0
|
|
413
|
+
} = event_1.nativeEvent;
|
|
419
414
|
onInteractionDown({
|
|
420
415
|
offsetX,
|
|
421
416
|
offsetY,
|
|
422
|
-
clientX,
|
|
423
|
-
clientY
|
|
424
|
-
},
|
|
425
|
-
}
|
|
426
|
-
const onTouchStart =
|
|
417
|
+
clientX: clientX_0,
|
|
418
|
+
clientY: clientY_0
|
|
419
|
+
}, event_1);
|
|
420
|
+
};
|
|
421
|
+
const onTouchStart = event_2 => {
|
|
427
422
|
// Get the first touch point
|
|
428
|
-
const touch =
|
|
423
|
+
const touch = event_2.touches[0];
|
|
429
424
|
const {
|
|
430
|
-
clientX,
|
|
431
|
-
clientY
|
|
425
|
+
clientX: clientX_1,
|
|
426
|
+
clientY: clientY_1
|
|
432
427
|
} = touch;
|
|
433
428
|
let {
|
|
434
|
-
offsetX,
|
|
435
|
-
offsetY
|
|
429
|
+
offsetX: offsetX_0,
|
|
430
|
+
offsetY: offsetY_0
|
|
436
431
|
} = touch;
|
|
437
432
|
const targetElement = touch.target;
|
|
438
433
|
if (targetElement instanceof HTMLElement) {
|
|
439
434
|
// Get the bounding rectangle of the target element
|
|
440
|
-
const
|
|
435
|
+
const rect_0 = targetElement.getBoundingClientRect();
|
|
441
436
|
|
|
442
437
|
// Calculate the offsetX and offsetY
|
|
443
|
-
|
|
444
|
-
|
|
438
|
+
offsetX_0 = touch.clientX - rect_0.left;
|
|
439
|
+
offsetY_0 = touch.clientY - rect_0.top;
|
|
445
440
|
}
|
|
446
441
|
onInteractionDown({
|
|
447
|
-
offsetX,
|
|
448
|
-
offsetY,
|
|
449
|
-
clientX,
|
|
450
|
-
clientY
|
|
451
|
-
},
|
|
452
|
-
}
|
|
453
|
-
const removeItems =
|
|
442
|
+
offsetX: offsetX_0,
|
|
443
|
+
offsetY: offsetY_0,
|
|
444
|
+
clientX: clientX_1,
|
|
445
|
+
clientY: clientY_1
|
|
446
|
+
}, event_2);
|
|
447
|
+
};
|
|
448
|
+
const removeItems = () => {
|
|
454
449
|
// remove
|
|
455
450
|
if (refs.remove.current.length) {
|
|
456
|
-
const
|
|
457
|
-
for (const
|
|
458
|
-
const index = refs.items.current.findIndex(itemItems => itemItems ===
|
|
459
|
-
if (index > -1)
|
|
451
|
+
const toRemove_1 = [];
|
|
452
|
+
for (const item_8 of refs.remove.current) {
|
|
453
|
+
const index = refs.items.current.findIndex(itemItems => itemItems === item_8);
|
|
454
|
+
if (index > -1) toRemove_1.push(item_8);
|
|
460
455
|
}
|
|
461
|
-
if (
|
|
456
|
+
if (toRemove_1.length) remove(toRemove_1);
|
|
462
457
|
refs.remove.current = [];
|
|
463
458
|
}
|
|
464
|
-
}
|
|
465
|
-
const onUpdateCoordinates =
|
|
466
|
-
const
|
|
467
|
-
|
|
468
|
-
const p = (
|
|
469
|
-
const ar = (
|
|
470
|
-
const s = (
|
|
459
|
+
};
|
|
460
|
+
const onUpdateCoordinates = () => {
|
|
461
|
+
const items_2 = getItems();
|
|
462
|
+
items_2.forEach(item_9 => {
|
|
463
|
+
const p = (item_9 === null || item_9 === void 0 ? void 0 : item_9.p) || [];
|
|
464
|
+
const ar = (item_9 === null || item_9 === void 0 ? void 0 : item_9.ar) || [];
|
|
465
|
+
const s = (item_9 === null || item_9 === void 0 ? void 0 : item_9.s) || {};
|
|
471
466
|
if (p.length) {
|
|
472
467
|
// cache
|
|
473
468
|
// x1, y1, width. height for position on the screen
|
|
474
|
-
const v =
|
|
469
|
+
const v = item_9.v;
|
|
475
470
|
|
|
476
471
|
// draw point
|
|
477
472
|
if (v === 'dp') {
|
|
478
473
|
const lineWidth = s.lineWidth || 10;
|
|
479
|
-
|
|
474
|
+
item_9.c = [p[0] - lineWidth / 2, p[1] - lineWidth / 2, lineWidth, lineWidth];
|
|
480
475
|
}
|
|
481
476
|
// draw line
|
|
482
477
|
else if (v === 'dl') {
|
|
483
|
-
const
|
|
484
|
-
const
|
|
485
|
-
for (let
|
|
486
|
-
|
|
487
|
-
|
|
478
|
+
const x_0 = [];
|
|
479
|
+
const y_0 = [];
|
|
480
|
+
for (let i_0 = 0; i_0 < p.length; i_0 += 2) {
|
|
481
|
+
x_0.push(p[i_0]);
|
|
482
|
+
y_0.push(p[i_0 + 1]);
|
|
488
483
|
}
|
|
489
|
-
const xMin = Math.min(...
|
|
490
|
-
const yMin = Math.min(...
|
|
491
|
-
const xMax = Math.max(...
|
|
492
|
-
const yMax = Math.max(...
|
|
493
|
-
|
|
484
|
+
const xMin = Math.min(...x_0);
|
|
485
|
+
const yMin = Math.min(...y_0);
|
|
486
|
+
const xMax = Math.max(...x_0);
|
|
487
|
+
const yMax = Math.max(...y_0);
|
|
488
|
+
item_9.c = [xMin, yMin, xMax - xMin, yMax - yMin];
|
|
494
489
|
}
|
|
495
490
|
// object line, object arrow
|
|
496
491
|
else if (['ol', 'oa'].includes(v)) {
|
|
497
|
-
const
|
|
498
|
-
const
|
|
499
|
-
const
|
|
500
|
-
const
|
|
501
|
-
const
|
|
502
|
-
const
|
|
503
|
-
|
|
492
|
+
const x_1 = [p[0], ar[0]];
|
|
493
|
+
const y_1 = [p[1], ar[1]];
|
|
494
|
+
const xMin_0 = Math.min(...x_1);
|
|
495
|
+
const yMin_0 = Math.min(...y_1);
|
|
496
|
+
const xMax_0 = Math.max(...x_1);
|
|
497
|
+
const yMax_0 = Math.max(...y_1);
|
|
498
|
+
item_9.c = [xMin_0, yMin_0, xMax_0 - xMin_0, yMax_0 - yMin_0];
|
|
504
499
|
}
|
|
505
500
|
// object rectangle, object square
|
|
506
501
|
else if (['or', 'os'].includes(v)) {
|
|
507
|
-
|
|
502
|
+
item_9.c = [...p, ...ar];
|
|
508
503
|
}
|
|
509
504
|
// object circle, object ellipse
|
|
510
505
|
else if (['oc', 'oe'].includes(v)) {
|
|
511
506
|
if (v === 'oc') {
|
|
512
|
-
|
|
507
|
+
item_9.c = [p[0] - ar[0], p[1] - ar[0], ar[0] * 2, ar[0] * 2];
|
|
513
508
|
} else {
|
|
514
|
-
|
|
509
|
+
item_9.c = [p[0] - ar[0], p[1] - ar[1], ar[0] * 2, ar[1] * 2];
|
|
515
510
|
}
|
|
516
511
|
}
|
|
517
512
|
// object triangle, object triangle equilateral
|
|
@@ -520,16 +515,16 @@ const Whiteboard = /*#__PURE__*/_react.default.forwardRef((props_, ref) => {
|
|
|
520
515
|
const {
|
|
521
516
|
height
|
|
522
517
|
} = s;
|
|
523
|
-
|
|
518
|
+
item_9.c = [x1, y1 - height, x2 - x1, height];
|
|
524
519
|
}
|
|
525
520
|
// image
|
|
526
521
|
else if (['i', 't'].includes(v)) {
|
|
527
|
-
|
|
522
|
+
item_9.c = [...p, ...ar];
|
|
528
523
|
}
|
|
529
524
|
}
|
|
530
525
|
});
|
|
531
|
-
}
|
|
532
|
-
const onSelect =
|
|
526
|
+
};
|
|
527
|
+
const onSelect = () => {
|
|
533
528
|
const select = refs.select.current;
|
|
534
529
|
if (!select) return;
|
|
535
530
|
const px1 = select.p[0];
|
|
@@ -544,28 +539,28 @@ const Whiteboard = /*#__PURE__*/_react.default.forwardRef((props_, ref) => {
|
|
|
544
539
|
x: Math.max(px1, px2),
|
|
545
540
|
y: Math.max(py1, py2)
|
|
546
541
|
};
|
|
547
|
-
const
|
|
548
|
-
|
|
542
|
+
const items_3 = getItems();
|
|
543
|
+
items_3.forEach(item_10 => {
|
|
549
544
|
const {
|
|
550
545
|
c
|
|
551
|
-
} =
|
|
552
|
-
const [
|
|
553
|
-
let [
|
|
554
|
-
|
|
555
|
-
y2 =
|
|
546
|
+
} = item_10;
|
|
547
|
+
const [x1_0, y1_0] = c;
|
|
548
|
+
let [x2_0, y2] = c;
|
|
549
|
+
x2_0 = x1_0 + x2_0;
|
|
550
|
+
y2 = y1_0 + y2;
|
|
556
551
|
const minItem = {
|
|
557
|
-
x: Math.min(
|
|
558
|
-
y: Math.min(
|
|
552
|
+
x: Math.min(x1_0, x2_0),
|
|
553
|
+
y: Math.min(y1_0, y2)
|
|
559
554
|
};
|
|
560
555
|
const maxItem = {
|
|
561
|
-
x: Math.max(
|
|
562
|
-
y: Math.max(
|
|
556
|
+
x: Math.max(x1_0, x2_0),
|
|
557
|
+
y: Math.max(y1_0, y2)
|
|
563
558
|
};
|
|
564
|
-
const
|
|
565
|
-
if (
|
|
559
|
+
const selected_0 = minItem.x >= min.x && maxItem.x <= max.x && minItem.y >= min.y && maxItem.y <= max.y;
|
|
560
|
+
if (selected_0) item_10.se = true;
|
|
566
561
|
});
|
|
567
|
-
}
|
|
568
|
-
const onMouseUp =
|
|
562
|
+
};
|
|
563
|
+
const onMouseUp = event_3 => {
|
|
569
564
|
if (refs.mouseDown.current) {
|
|
570
565
|
refs.select.current = null;
|
|
571
566
|
|
|
@@ -587,37 +582,37 @@ const Whiteboard = /*#__PURE__*/_react.default.forwardRef((props_, ref) => {
|
|
|
587
582
|
}
|
|
588
583
|
render();
|
|
589
584
|
}
|
|
590
|
-
}
|
|
591
|
-
const updateTextBoxDimensions =
|
|
592
|
-
const
|
|
585
|
+
};
|
|
586
|
+
const updateTextBoxDimensions = item_11 => {
|
|
587
|
+
const ui_0 = refs.ui.current.getContext('2d');
|
|
593
588
|
const {
|
|
594
|
-
lineHeight,
|
|
595
|
-
padding
|
|
589
|
+
lineHeight: lineHeight_0,
|
|
590
|
+
padding: padding_0
|
|
596
591
|
} = refs.textSettings.current;
|
|
597
|
-
|
|
598
|
-
const maxWidth = Math.max(...
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
}
|
|
602
|
-
const getPath =
|
|
592
|
+
ui_0.font = '16px Arial';
|
|
593
|
+
const maxWidth = Math.max(...item_11.s.lines.map(line => ui_0.measureText(line).width));
|
|
594
|
+
item_11.ar[0] = maxWidth + padding_0 * 2.5;
|
|
595
|
+
item_11.ar[1] = item_11.s.lines.length * lineHeight_0 + padding_0 * 2;
|
|
596
|
+
};
|
|
597
|
+
const getPath = item_12 => {
|
|
603
598
|
const path = new Path2D();
|
|
604
599
|
const {
|
|
605
|
-
v,
|
|
606
|
-
p,
|
|
607
|
-
ar
|
|
608
|
-
} =
|
|
600
|
+
v: v_0,
|
|
601
|
+
p: p_0,
|
|
602
|
+
ar: ar_0
|
|
603
|
+
} = item_12;
|
|
609
604
|
|
|
610
605
|
// draw line
|
|
611
|
-
if (
|
|
612
|
-
const points = (0, _utils.arrayToParts)(
|
|
613
|
-
for (let
|
|
614
|
-
const current = points[
|
|
615
|
-
const next = points[
|
|
606
|
+
if (v_0 === 'dl') {
|
|
607
|
+
const points = (0, _utils.arrayToParts)(p_0, 2);
|
|
608
|
+
for (let i_1 = 0; i_1 < points.length - 1; i_1++) {
|
|
609
|
+
const current = points[i_1];
|
|
610
|
+
const next = points[i_1 + 1];
|
|
616
611
|
|
|
617
612
|
// calculate the control point for the curve
|
|
618
613
|
const midX = (current[0] + next[0]) / 2;
|
|
619
614
|
const midY = (current[1] + next[1]) / 2;
|
|
620
|
-
if (
|
|
615
|
+
if (i_1 === 0) {
|
|
621
616
|
// start from the first point
|
|
622
617
|
path.moveTo(current[0], current[1]);
|
|
623
618
|
}
|
|
@@ -625,308 +620,308 @@ const Whiteboard = /*#__PURE__*/_react.default.forwardRef((props_, ref) => {
|
|
|
625
620
|
}
|
|
626
621
|
}
|
|
627
622
|
// draw point, object circle
|
|
628
|
-
else if (['dp', 'oc'].includes(
|
|
629
|
-
path.arc(
|
|
623
|
+
else if (['dp', 'oc'].includes(v_0) && ar_0.length === 3) {
|
|
624
|
+
path.arc(p_0[0], p_0[1], ...ar_0);
|
|
630
625
|
}
|
|
631
626
|
// object ellipse
|
|
632
|
-
else if (
|
|
633
|
-
path.ellipse(
|
|
627
|
+
else if (v_0 === 'oe' && ar_0.length === 5) {
|
|
628
|
+
path.ellipse(p_0[0], p_0[1], ...ar_0);
|
|
634
629
|
}
|
|
635
630
|
// object rectangle
|
|
636
|
-
else if (['or', 'os'].includes(
|
|
637
|
-
path.roundRect(
|
|
631
|
+
else if (['or', 'os'].includes(v_0)) {
|
|
632
|
+
path.roundRect(p_0[0], p_0[1], ...ar_0);
|
|
638
633
|
}
|
|
639
634
|
// object line
|
|
640
|
-
else if (['ol', 'oa'].includes(
|
|
641
|
-
path.moveTo(
|
|
642
|
-
path.lineTo(...
|
|
635
|
+
else if (['ol', 'oa'].includes(v_0) && ar_0.length === 2) {
|
|
636
|
+
path.moveTo(p_0[0], p_0[1]);
|
|
637
|
+
path.lineTo(...ar_0);
|
|
643
638
|
|
|
644
639
|
// draw an arrow
|
|
645
|
-
if (
|
|
640
|
+
if (v_0 === 'oa') {
|
|
646
641
|
// Length of the arrowhead
|
|
647
642
|
const headLength = 40;
|
|
648
|
-
const angle = Math.atan2(
|
|
649
|
-
path.moveTo(
|
|
650
|
-
path.lineTo(
|
|
651
|
-
path.moveTo(
|
|
652
|
-
path.lineTo(
|
|
643
|
+
const angle = Math.atan2(ar_0[1] - p_0[1], ar_0[0] - p_0[0]);
|
|
644
|
+
path.moveTo(ar_0[0], ar_0[1]);
|
|
645
|
+
path.lineTo(ar_0[0] - headLength * Math.cos(angle - Math.PI / 6), ar_0[1] - headLength * Math.sin(angle - Math.PI / 6));
|
|
646
|
+
path.moveTo(ar_0[0], ar_0[1]);
|
|
647
|
+
path.lineTo(ar_0[0] - headLength * Math.cos(angle + Math.PI / 6), ar_0[1] - headLength * Math.sin(angle + Math.PI / 6));
|
|
653
648
|
}
|
|
654
649
|
}
|
|
655
650
|
// object triangle
|
|
656
|
-
else if (['ot', 'ote'].includes(
|
|
657
|
-
path.moveTo(
|
|
658
|
-
path.lineTo(
|
|
659
|
-
path.lineTo(
|
|
651
|
+
else if (['ot', 'ote'].includes(v_0)) {
|
|
652
|
+
path.moveTo(p_0[0], p_0[1]);
|
|
653
|
+
path.lineTo(p_0[2], p_0[3]);
|
|
654
|
+
path.lineTo(p_0[4], p_0[5]);
|
|
660
655
|
path.closePath();
|
|
661
656
|
}
|
|
662
657
|
return path;
|
|
663
|
-
}
|
|
664
|
-
const draw =
|
|
665
|
-
var
|
|
666
|
-
const
|
|
658
|
+
};
|
|
659
|
+
const draw = item_13 => {
|
|
660
|
+
var _item_13$s2, _item_13$s3;
|
|
661
|
+
const ui_1 = refs.ui.current.getContext('2d');
|
|
667
662
|
|
|
668
663
|
// settings
|
|
669
|
-
Object.keys(
|
|
670
|
-
var
|
|
671
|
-
return
|
|
664
|
+
Object.keys(item_13.s || {}).forEach(key => {
|
|
665
|
+
var _item_13$s;
|
|
666
|
+
return ui_1[key] = (_item_13$s = item_13.s) === null || _item_13$s === void 0 ? void 0 : _item_13$s[key];
|
|
672
667
|
});
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
const
|
|
676
|
-
const
|
|
677
|
-
if (['dp'].includes(
|
|
678
|
-
}
|
|
679
|
-
const drawGrid =
|
|
668
|
+
ui_1.globalAlpha = refs.remove.current.includes(item_13) ? 0.25 : ((_item_13$s2 = item_13.s) === null || _item_13$s2 === void 0 ? void 0 : _item_13$s2.globalAlpha) !== undefined ? (_item_13$s3 = item_13.s) === null || _item_13$s3 === void 0 ? void 0 : _item_13$s3.globalAlpha : 1;
|
|
669
|
+
ui_1.beginPath();
|
|
670
|
+
const path_0 = getPath(item_13);
|
|
671
|
+
const v_1 = item_13.v;
|
|
672
|
+
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);
|
|
673
|
+
};
|
|
674
|
+
const drawGrid = () => {
|
|
680
675
|
const uiCanvas = refs.ui.current;
|
|
681
|
-
const
|
|
676
|
+
const ui_2 = refs.ui.current.getContext('2d');
|
|
682
677
|
const zoom = refs.scale.current;
|
|
683
678
|
const gridSize = 70;
|
|
684
|
-
const
|
|
685
|
-
const
|
|
679
|
+
const offsetX_1 = refs.move.current.x / zoom;
|
|
680
|
+
const offsetY_1 = refs.move.current.y / zoom;
|
|
686
681
|
|
|
687
682
|
// Calculate start positions based on offsets
|
|
688
|
-
const startX = Math.floor(-
|
|
689
|
-
const startY = Math.floor(-
|
|
683
|
+
const startX = Math.floor(-offsetX_1 / gridSize) * gridSize;
|
|
684
|
+
const startY = Math.floor(-offsetY_1 / gridSize) * gridSize;
|
|
690
685
|
const width = uiCanvas.clientWidth * 1.5 / (zoom < 1 ? zoom : 1);
|
|
691
|
-
const
|
|
686
|
+
const height_0 = uiCanvas.clientHeight * 1.5 / (zoom < 1 ? zoom : 1);
|
|
692
687
|
if (gridSize < 30) return;
|
|
693
688
|
|
|
694
689
|
// Draw main grid lines
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
690
|
+
ui_2.globalAlpha = 1;
|
|
691
|
+
ui_2.lineWidth = (zoom < 0.5 ? 0.3 : zoom <= 1 ? 0.5 : 0.7) / zoom;
|
|
692
|
+
ui_2.strokeStyle = '#ccc';
|
|
698
693
|
|
|
699
694
|
// grid
|
|
700
|
-
for (let
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
695
|
+
for (let x_2 = startX; x_2 < width + Math.abs(startX); x_2 += gridSize) {
|
|
696
|
+
ui_2.beginPath();
|
|
697
|
+
ui_2.moveTo(x_2, startY);
|
|
698
|
+
ui_2.lineTo(x_2, height_0 + startY);
|
|
699
|
+
ui_2.stroke();
|
|
705
700
|
}
|
|
706
|
-
for (let
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
701
|
+
for (let y_2 = startY; y_2 < height_0 + Math.abs(startY); y_2 += gridSize) {
|
|
702
|
+
ui_2.beginPath();
|
|
703
|
+
ui_2.moveTo(startX, y_2);
|
|
704
|
+
ui_2.lineTo(width + startX, y_2);
|
|
705
|
+
ui_2.stroke();
|
|
711
706
|
}
|
|
712
707
|
|
|
713
708
|
// subgrid
|
|
714
709
|
if (gridSize * zoom > 100) {
|
|
715
710
|
// Draw subgrid lines if zoomed in
|
|
716
711
|
const subGridSize = gridSize / 5;
|
|
717
|
-
|
|
718
|
-
|
|
712
|
+
ui_2.lineWidth = (zoom <= 5 ? 0.6 : zoom <= 10 ? 0.8 : 1) / zoom;
|
|
713
|
+
ui_2.strokeStyle = '#ddd';
|
|
719
714
|
const dash = zoom < 1 ? 3 * zoom : 3 / zoom;
|
|
720
|
-
|
|
721
|
-
for (let
|
|
715
|
+
ui_2.setLineDash([dash, dash]);
|
|
716
|
+
for (let x_3 = startX; x_3 < width + Math.abs(startX); x_3 += subGridSize) {
|
|
722
717
|
// without overlap
|
|
723
|
-
if (!(
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
718
|
+
if (!(x_3 % gridSize)) continue;
|
|
719
|
+
ui_2.beginPath();
|
|
720
|
+
ui_2.moveTo(x_3, startY);
|
|
721
|
+
ui_2.lineTo(x_3, height_0 + startY);
|
|
722
|
+
ui_2.stroke();
|
|
728
723
|
}
|
|
729
|
-
for (let
|
|
724
|
+
for (let y_3 = startY; y_3 < height_0 + Math.abs(startY); y_3 += subGridSize) {
|
|
730
725
|
// without overlap
|
|
731
|
-
if (!(
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
726
|
+
if (!(y_3 % gridSize)) continue;
|
|
727
|
+
ui_2.beginPath();
|
|
728
|
+
ui_2.moveTo(startX, y_3);
|
|
729
|
+
ui_2.lineTo(width + startX, y_3);
|
|
730
|
+
ui_2.stroke();
|
|
736
731
|
}
|
|
737
|
-
|
|
732
|
+
ui_2.setLineDash([]); // Reset line dash
|
|
738
733
|
}
|
|
739
|
-
}
|
|
740
|
-
const drawImage =
|
|
741
|
-
const
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
}
|
|
745
|
-
const drawCursor =
|
|
746
|
-
if (!
|
|
747
|
-
const
|
|
734
|
+
};
|
|
735
|
+
const drawImage = item_14 => {
|
|
736
|
+
const ui_3 = refs.ui.current.getContext('2d');
|
|
737
|
+
ui_3.globalAlpha = 1;
|
|
738
|
+
ui_3.drawImage(item_14.s.image || refs.image.current, ...item_14.p, ...item_14.ar);
|
|
739
|
+
};
|
|
740
|
+
const drawCursor = item_15 => {
|
|
741
|
+
if (!item_15 || !item_15.s.cursor) return;
|
|
742
|
+
const ui_4 = refs.ui.current.getContext('2d');
|
|
748
743
|
const {
|
|
749
|
-
line,
|
|
744
|
+
line: line_0,
|
|
750
745
|
char
|
|
751
|
-
} =
|
|
752
|
-
const currentLine =
|
|
753
|
-
const textWidth =
|
|
746
|
+
} = item_15.s.cursor;
|
|
747
|
+
const currentLine = item_15.s.lines[line_0] || '';
|
|
748
|
+
const textWidth = ui_4.measureText(currentLine.slice(0, char)).width;
|
|
754
749
|
const {
|
|
755
|
-
padding,
|
|
756
|
-
lineHeight
|
|
750
|
+
padding: padding_1,
|
|
751
|
+
lineHeight: lineHeight_1
|
|
757
752
|
} = refs.textSettings.current;
|
|
758
|
-
const cursorX =
|
|
759
|
-
const cursorY =
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
}
|
|
763
|
-
const drawText =
|
|
764
|
-
const
|
|
765
|
-
const
|
|
766
|
-
const [
|
|
767
|
-
const [
|
|
753
|
+
const cursorX = item_15.p[0] + padding_1 + textWidth;
|
|
754
|
+
const cursorY = item_15.p[1] + padding_1 + (line_0 + 1) * lineHeight_1;
|
|
755
|
+
ui_4.fillStyle = 'black';
|
|
756
|
+
ui_4.fillRect(cursorX, cursorY - lineHeight_1 + 3, 2, lineHeight_1 - 5);
|
|
757
|
+
};
|
|
758
|
+
const drawText = item_16 => {
|
|
759
|
+
const ui_5 = refs.ui.current.getContext('2d');
|
|
760
|
+
const zoom_0 = refs.scale.current;
|
|
761
|
+
const [x_4, y_4] = item_16.p;
|
|
762
|
+
const [width_0, height_1] = item_16.ar;
|
|
768
763
|
const {
|
|
769
|
-
lineHeight,
|
|
770
|
-
padding,
|
|
764
|
+
lineHeight: lineHeight_2,
|
|
765
|
+
padding: padding_2,
|
|
771
766
|
fillStyle
|
|
772
767
|
} = refs.textSettings.current;
|
|
773
|
-
const
|
|
768
|
+
const selected_1 = refs.tool.current === 'text' && item_16.se;
|
|
774
769
|
|
|
775
770
|
// Draw the box
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
771
|
+
ui_5.globalAlpha = 1;
|
|
772
|
+
ui_5.fillStyle = 'transparent';
|
|
773
|
+
ui_5.fillRect(x_4, y_4, width_0, height_1);
|
|
774
|
+
ui_5.lineWidth = 1 / zoom_0;
|
|
775
|
+
ui_5.strokeStyle = selected_1 ? colorSelect : 'transparent';
|
|
776
|
+
ui_5.strokeRect(x_4, y_4, width_0, height_1);
|
|
782
777
|
|
|
783
778
|
// Draw the text
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
779
|
+
ui_5.fillStyle = fillStyle || 'black';
|
|
780
|
+
ui_5.font = '16px Arial';
|
|
781
|
+
item_16.s.lines.forEach((line_1, index_0) => {
|
|
782
|
+
ui_5.fillText(line_1, x_4 + padding_2, y_4 + padding_2 + (index_0 + 1) * lineHeight_2 - 5);
|
|
788
783
|
});
|
|
789
|
-
if (
|
|
790
|
-
}
|
|
791
|
-
const drawSelect =
|
|
792
|
-
const
|
|
793
|
-
const [
|
|
794
|
-
const
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
}
|
|
803
|
-
const drawSelection =
|
|
804
|
-
const
|
|
805
|
-
const
|
|
784
|
+
if (selected_1) drawCursor(item_16);
|
|
785
|
+
};
|
|
786
|
+
const drawSelect = item_17 => {
|
|
787
|
+
const ui_6 = refs.ui.current.getContext('2d');
|
|
788
|
+
const [x_5, y_5, width_1, height_2] = item_17.c || [];
|
|
789
|
+
const path_1 = new Path2D();
|
|
790
|
+
path_1.rect(x_5, y_5, width_1, height_2);
|
|
791
|
+
ui_6.globalAlpha = 1;
|
|
792
|
+
ui_6.strokeStyle = colorSelect;
|
|
793
|
+
ui_6.lineCap = 'square';
|
|
794
|
+
ui_6.lineJoin = 'bevel';
|
|
795
|
+
ui_6.lineWidth = 1 / refs.scale.current;
|
|
796
|
+
ui_6.stroke(path_1);
|
|
797
|
+
};
|
|
798
|
+
const drawSelection = () => {
|
|
799
|
+
const ui_7 = refs.ui.current.getContext('2d');
|
|
800
|
+
const zoom_1 = refs.scale.current;
|
|
806
801
|
|
|
807
802
|
// canvas selection
|
|
808
|
-
const
|
|
809
|
-
if (
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
const
|
|
818
|
-
|
|
819
|
-
|
|
803
|
+
const select_0 = refs.select.current;
|
|
804
|
+
if (select_0) {
|
|
805
|
+
ui_7.globalAlpha = 1;
|
|
806
|
+
ui_7.globalCompositeOperation = 'source-over';
|
|
807
|
+
ui_7.lineWidth = 1 / zoom_1;
|
|
808
|
+
ui_7.lineCap = 'square';
|
|
809
|
+
ui_7.lineJoin = 'bevel';
|
|
810
|
+
ui_7.strokeStyle = colorSelect;
|
|
811
|
+
ui_7.fillStyle = colorSelectBackground;
|
|
812
|
+
const path_2 = getPath(select_0);
|
|
813
|
+
ui_7.fill(path_2);
|
|
814
|
+
ui_7.stroke(path_2);
|
|
820
815
|
}
|
|
821
|
-
}
|
|
822
|
-
const render =
|
|
823
|
-
const
|
|
824
|
-
const
|
|
816
|
+
};
|
|
817
|
+
const render = () => {
|
|
818
|
+
const ui_8 = refs.ui.current.getContext('2d');
|
|
819
|
+
const items_4 = refs.items.current.filter(Boolean);
|
|
825
820
|
|
|
826
821
|
// methods
|
|
827
|
-
|
|
828
|
-
|
|
822
|
+
ui_8.clearRect(0, 0, refs.ui.current.width, refs.ui.current.height);
|
|
823
|
+
ui_8.save();
|
|
829
824
|
|
|
830
825
|
// pan
|
|
831
|
-
|
|
826
|
+
ui_8.translate(refs.move.current.x, refs.move.current.y);
|
|
832
827
|
// zoom
|
|
833
|
-
|
|
828
|
+
ui_8.scale(refs.scale.current, refs.scale.current);
|
|
834
829
|
|
|
835
830
|
// grid
|
|
836
831
|
if (refs.grid.current) drawGrid();
|
|
837
832
|
|
|
838
833
|
// draw
|
|
839
|
-
|
|
834
|
+
items_4.forEach(item_18 => {
|
|
840
835
|
// image
|
|
841
|
-
if (
|
|
836
|
+
if (item_18.v === 'i' && item_18.ar.length === 2) drawImage(item_18);
|
|
842
837
|
// text
|
|
843
|
-
else if (
|
|
838
|
+
else if (item_18.v === 't') drawText(item_18);
|
|
844
839
|
// other
|
|
845
|
-
else draw(
|
|
840
|
+
else draw(item_18);
|
|
846
841
|
|
|
847
842
|
// select
|
|
848
|
-
if (
|
|
843
|
+
if (item_18.se) drawSelect(item_18);
|
|
849
844
|
});
|
|
850
845
|
|
|
851
846
|
// canvas selection
|
|
852
847
|
drawSelection();
|
|
853
|
-
|
|
854
|
-
}
|
|
848
|
+
ui_8.restore();
|
|
849
|
+
};
|
|
855
850
|
|
|
856
851
|
// Snap angle to nearest multiple of 15 degrees
|
|
857
|
-
const snapToAngle =
|
|
852
|
+
const snapToAngle = (dx, dy) => {
|
|
858
853
|
// Current angle in radians
|
|
859
|
-
const
|
|
854
|
+
const angle_0 = Math.atan2(dy, dx);
|
|
860
855
|
// Snap to nearest 15 degrees
|
|
861
|
-
const snappedAngle = Math.round(
|
|
856
|
+
const snappedAngle = Math.round(angle_0 / (Math.PI / 12)) * (Math.PI / 12);
|
|
862
857
|
// Length of the vector
|
|
863
858
|
const length = Math.sqrt(dx * dx + dy * dy);
|
|
864
859
|
return {
|
|
865
860
|
x: Math.cos(snappedAngle) * length,
|
|
866
861
|
y: Math.sin(snappedAngle) * length
|
|
867
862
|
};
|
|
868
|
-
}
|
|
869
|
-
const onMoveItems =
|
|
870
|
-
const
|
|
871
|
-
|
|
872
|
-
const
|
|
863
|
+
};
|
|
864
|
+
const onMoveItems = (x_6, y_6) => {
|
|
865
|
+
const itemsSelected_0 = getItems(true);
|
|
866
|
+
itemsSelected_0.forEach(item_19 => {
|
|
867
|
+
const v_2 = item_19.v;
|
|
873
868
|
|
|
874
869
|
// draw line
|
|
875
|
-
if (
|
|
876
|
-
|
|
877
|
-
return
|
|
870
|
+
if (v_2 === 'dl') {
|
|
871
|
+
item_19.p = item_19.p.map((value, index_1) => {
|
|
872
|
+
return index_1 % 2 ? value + y_6 : value + x_6;
|
|
878
873
|
});
|
|
879
874
|
}
|
|
880
875
|
|
|
881
876
|
// rectangle, draw point, object circle, ellipse, object line, object arrow, object triangle, image, text
|
|
882
|
-
if (['or', 'os', 'dp', 'oc', 'oe', 'ol', 'oa', 'ot', 'ote', 'i', 't'].includes(
|
|
883
|
-
|
|
884
|
-
|
|
877
|
+
if (['or', 'os', 'dp', 'oc', 'oe', 'ol', 'oa', 'ot', 'ote', 'i', 't'].includes(v_2)) {
|
|
878
|
+
item_19.p[0] += x_6;
|
|
879
|
+
item_19.p[1] += y_6;
|
|
885
880
|
}
|
|
886
881
|
|
|
887
882
|
// object line
|
|
888
|
-
if (['ol', 'oa'].includes(
|
|
889
|
-
|
|
890
|
-
|
|
883
|
+
if (['ol', 'oa'].includes(v_2)) {
|
|
884
|
+
item_19.ar[0] += x_6;
|
|
885
|
+
item_19.ar[1] += y_6;
|
|
891
886
|
}
|
|
892
887
|
|
|
893
888
|
// object triangle
|
|
894
|
-
if (['ot', 'ote'].includes(
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
889
|
+
if (['ot', 'ote'].includes(v_2)) {
|
|
890
|
+
item_19.p[2] += x_6;
|
|
891
|
+
item_19.p[4] += x_6;
|
|
892
|
+
item_19.p[3] += y_6;
|
|
893
|
+
item_19.p[5] += y_6;
|
|
899
894
|
}
|
|
900
895
|
});
|
|
901
896
|
onUpdateCoordinates();
|
|
902
|
-
}
|
|
903
|
-
const onMove =
|
|
897
|
+
};
|
|
898
|
+
const onMove = (body_0, event_4) => {
|
|
904
899
|
if (!refs.on.current) return;
|
|
905
900
|
const {
|
|
906
|
-
offsetX:
|
|
907
|
-
offsetY:
|
|
908
|
-
clientX,
|
|
909
|
-
clientY
|
|
910
|
-
} =
|
|
911
|
-
const xo = transform(
|
|
912
|
-
const yo = transform(
|
|
913
|
-
const
|
|
914
|
-
const
|
|
915
|
-
const currentX =
|
|
916
|
-
const currentY =
|
|
917
|
-
const
|
|
918
|
-
const
|
|
919
|
-
x: transform(
|
|
920
|
-
y: transform(
|
|
901
|
+
offsetX: x_7,
|
|
902
|
+
offsetY: y_7,
|
|
903
|
+
clientX: clientX_2,
|
|
904
|
+
clientY: clientY_2
|
|
905
|
+
} = body_0;
|
|
906
|
+
const xo = transform(x_7 - refs.move.current.x);
|
|
907
|
+
const yo = transform(y_7 - refs.move.current.y);
|
|
908
|
+
const ui_9 = refs.ui.current.getContext('2d');
|
|
909
|
+
const rect_1 = refs.ui.current.getBoundingClientRect();
|
|
910
|
+
const currentX = clientX_2 - rect_1.left;
|
|
911
|
+
const currentY = clientY_2 - rect_1.top;
|
|
912
|
+
const start_0 = refs.start.current;
|
|
913
|
+
const startTransformed_0 = {
|
|
914
|
+
x: transform(start_0.x - refs.move.current.x),
|
|
915
|
+
y: transform(start_0.y - refs.move.current.y)
|
|
921
916
|
};
|
|
922
|
-
const
|
|
923
|
-
const
|
|
924
|
-
const
|
|
925
|
-
const shiftKey =
|
|
926
|
-
const
|
|
917
|
+
const item_20 = getItem();
|
|
918
|
+
const items_5 = getItems();
|
|
919
|
+
const t_0 = refs.tool.current;
|
|
920
|
+
const shiftKey = event_4.shiftKey;
|
|
921
|
+
const zoom_2 = refs.scale.current;
|
|
927
922
|
refs.mouseMove.current.current = {
|
|
928
|
-
x:
|
|
929
|
-
y:
|
|
923
|
+
x: clientX_2 / zoom_2,
|
|
924
|
+
y: clientY_2 / zoom_2
|
|
930
925
|
};
|
|
931
926
|
refs.mouseMove.current.delta = {
|
|
932
927
|
x: refs.mouseMove.current.previous ? refs.mouseMove.current.current.x - refs.mouseMove.current.previous.x : 0,
|
|
@@ -936,137 +931,137 @@ const Whiteboard = /*#__PURE__*/_react.default.forwardRef((props_, ref) => {
|
|
|
936
931
|
const delta = refs.mouseMove.current.delta;
|
|
937
932
|
|
|
938
933
|
// select
|
|
939
|
-
if (
|
|
934
|
+
if (t_0 === 'select') {
|
|
940
935
|
if (!refs.moveStarted.current) refs.moveStarted.current = true;
|
|
941
936
|
if (refs.select.current) {
|
|
942
937
|
unselectAll();
|
|
943
|
-
const
|
|
944
|
-
const
|
|
938
|
+
const width_2 = currentX - start_0.x;
|
|
939
|
+
const height_3 = currentY - start_0.y;
|
|
945
940
|
const isSquare = shiftKey;
|
|
946
941
|
const radius = 0;
|
|
947
942
|
if (isSquare) {
|
|
948
|
-
const side = Math.min(Math.abs(
|
|
943
|
+
const side = Math.min(Math.abs(width_2), Math.abs(height_3));
|
|
949
944
|
refs.select.current.v = 'os';
|
|
950
|
-
refs.select.current.p = [
|
|
951
|
-
refs.select.current.ar = [transform(Math.sign(
|
|
945
|
+
refs.select.current.p = [startTransformed_0.x, startTransformed_0.y];
|
|
946
|
+
refs.select.current.ar = [transform(Math.sign(width_2) * side), transform(Math.sign(height_3) * side), radius];
|
|
952
947
|
} else {
|
|
953
948
|
refs.select.current.v = 'or';
|
|
954
|
-
refs.select.current.p = [
|
|
955
|
-
refs.select.current.ar = [transform(
|
|
949
|
+
refs.select.current.p = [startTransformed_0.x, startTransformed_0.y];
|
|
950
|
+
refs.select.current.ar = [transform(width_2), transform(height_3), radius];
|
|
956
951
|
}
|
|
957
952
|
} else onMoveItems(delta.x, delta.y);
|
|
958
953
|
}
|
|
959
954
|
// pen
|
|
960
|
-
else if (
|
|
955
|
+
else if (t_0 === 'pen' && item_20) {
|
|
961
956
|
// same path from draw point, to move
|
|
962
957
|
if (!refs.moveStarted.current) {
|
|
963
|
-
|
|
958
|
+
item_20.v = 'dl';
|
|
964
959
|
refs.moveStarted.current = true;
|
|
965
960
|
}
|
|
966
961
|
|
|
967
962
|
// Add the current point to the path
|
|
968
|
-
|
|
963
|
+
item_20.p.push(xo, yo);
|
|
969
964
|
}
|
|
970
965
|
// pan
|
|
971
|
-
else if (
|
|
972
|
-
refs.move.current.x =
|
|
973
|
-
refs.move.current.y =
|
|
966
|
+
else if (t_0 === 'pan') {
|
|
967
|
+
refs.move.current.x = x_7 - refs.previous.current.x + refs.offset.current.x;
|
|
968
|
+
refs.move.current.y = y_7 - refs.previous.current.y + refs.offset.current.y;
|
|
974
969
|
}
|
|
975
970
|
// eraser
|
|
976
|
-
else if (
|
|
971
|
+
else if (t_0 === 'eraser') {
|
|
977
972
|
// find all items that x, y collides with, with certain radius
|
|
978
|
-
for (const
|
|
979
|
-
const isPointInStroke =
|
|
980
|
-
if (isPointInStroke) refs.remove.current.push(
|
|
973
|
+
for (const i_2 of items_5) {
|
|
974
|
+
const isPointInStroke = ui_9.isPointInStroke(getPath(i_2), xo, yo);
|
|
975
|
+
if (isPointInStroke) refs.remove.current.push(i_2);
|
|
981
976
|
}
|
|
982
977
|
}
|
|
983
978
|
// object line, object arrow
|
|
984
|
-
else if (['line', 'line-arrow'].includes(
|
|
979
|
+
else if (['line', 'line-arrow'].includes(t_0)) {
|
|
985
980
|
const snapAt15Degrees = shiftKey;
|
|
986
981
|
let endX = currentX;
|
|
987
982
|
let endY = currentY;
|
|
988
983
|
if (snapAt15Degrees) {
|
|
989
|
-
const snapped = snapToAngle(currentX -
|
|
990
|
-
endX =
|
|
991
|
-
endY =
|
|
984
|
+
const snapped = snapToAngle(currentX - start_0.x, currentY - start_0.y);
|
|
985
|
+
endX = start_0.x + snapped.x;
|
|
986
|
+
endY = start_0.y + snapped.y;
|
|
992
987
|
}
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
988
|
+
item_20.v = t_0 === 'line' ? 'ol' : 'oa';
|
|
989
|
+
item_20.p = [startTransformed_0.x, startTransformed_0.y];
|
|
990
|
+
item_20.ar = [transform(endX - refs.move.current.x), transform(endY - refs.move.current.y)];
|
|
996
991
|
}
|
|
997
992
|
// object circle
|
|
998
|
-
else if (
|
|
999
|
-
const
|
|
1000
|
-
const
|
|
993
|
+
else if (t_0 === 'circle') {
|
|
994
|
+
const width_3 = currentX - start_0.x;
|
|
995
|
+
const height_4 = currentY - start_0.y;
|
|
1001
996
|
const isCircle = shiftKey;
|
|
1002
997
|
if (isCircle) {
|
|
1003
|
-
const
|
|
1004
|
-
const centerX =
|
|
1005
|
-
const centerY =
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
998
|
+
const radius_0 = Math.min(Math.abs(width_3), Math.abs(height_4)) / 2;
|
|
999
|
+
const centerX = start_0.x + Math.sign(width_3) * radius_0;
|
|
1000
|
+
const centerY = start_0.y + Math.sign(height_4) * radius_0;
|
|
1001
|
+
item_20.v = 'oc';
|
|
1002
|
+
item_20.p = [transform(centerX - refs.move.current.x), transform(centerY - refs.move.current.y)];
|
|
1003
|
+
item_20.ar = [transform(radius_0), 0, Math.PI * 2];
|
|
1009
1004
|
} else {
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1005
|
+
item_20.v = 'oe';
|
|
1006
|
+
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)];
|
|
1007
|
+
item_20.ar = [transform(Math.abs(width_3) / 2), transform(Math.abs(height_4) / 2), 0, 0, Math.PI * 2];
|
|
1013
1008
|
}
|
|
1014
1009
|
}
|
|
1015
1010
|
// object rectangle
|
|
1016
|
-
else if (
|
|
1017
|
-
const
|
|
1018
|
-
const
|
|
1019
|
-
const
|
|
1020
|
-
const
|
|
1021
|
-
if (
|
|
1022
|
-
const
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1011
|
+
else if (t_0 === 'rectangle') {
|
|
1012
|
+
const width_4 = currentX - start_0.x;
|
|
1013
|
+
const height_5 = currentY - start_0.y;
|
|
1014
|
+
const isSquare_0 = shiftKey;
|
|
1015
|
+
const radius_1 = 0;
|
|
1016
|
+
if (isSquare_0) {
|
|
1017
|
+
const side_0 = Math.min(Math.abs(width_4), Math.abs(height_5));
|
|
1018
|
+
item_20.v = 'os';
|
|
1019
|
+
item_20.p = [startTransformed_0.x, startTransformed_0.y];
|
|
1020
|
+
item_20.ar = [transform(Math.sign(width_4) * side_0), transform(Math.sign(height_5) * side_0), radius_1];
|
|
1026
1021
|
} else {
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1022
|
+
item_20.v = 'or';
|
|
1023
|
+
item_20.p = [startTransformed_0.x, startTransformed_0.y];
|
|
1024
|
+
item_20.ar = [transform(width_4), transform(height_5), radius_1];
|
|
1030
1025
|
}
|
|
1031
1026
|
}
|
|
1032
1027
|
// object triangle
|
|
1033
|
-
else if (['triangle'].includes(
|
|
1034
|
-
const
|
|
1035
|
-
const
|
|
1036
|
-
const base = Math.abs(
|
|
1037
|
-
const
|
|
1038
|
-
const
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
height
|
|
1028
|
+
else if (['triangle'].includes(t_0)) {
|
|
1029
|
+
const endX_0 = xo;
|
|
1030
|
+
const endY_0 = yo;
|
|
1031
|
+
const base = Math.abs(endX_0 - startTransformed_0.x);
|
|
1032
|
+
const height_6 = shiftKey ? base * Math.sqrt(3) / 2 : Math.abs(endY_0 - startTransformed_0.y);
|
|
1033
|
+
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];
|
|
1034
|
+
item_20.v = shiftKey ? 'ote' : 'ot';
|
|
1035
|
+
item_20.p = points_0;
|
|
1036
|
+
item_20.s = _objectSpread(_objectSpread({}, item_20.s), {}, {
|
|
1037
|
+
height: height_6
|
|
1043
1038
|
});
|
|
1044
1039
|
}
|
|
1045
1040
|
// image
|
|
1046
|
-
else if (
|
|
1047
|
-
const
|
|
1048
|
-
const
|
|
1041
|
+
else if (t_0 === 'image' && refs.image.current.complete && refs.image.current.src) {
|
|
1042
|
+
const width_5 = transform(currentX - start_0.x);
|
|
1043
|
+
const height_7 = transform(currentY - start_0.y);
|
|
1049
1044
|
const keepAspectRatio = !shiftKey;
|
|
1050
1045
|
let currentWidth;
|
|
1051
1046
|
let currentHeight;
|
|
1052
1047
|
if (keepAspectRatio) {
|
|
1053
|
-
if (Math.abs(
|
|
1054
|
-
currentWidth =
|
|
1055
|
-
currentHeight =
|
|
1048
|
+
if (Math.abs(width_5 / refs.aspectRatio.current) <= Math.abs(height_7)) {
|
|
1049
|
+
currentWidth = width_5;
|
|
1050
|
+
currentHeight = width_5 / refs.aspectRatio.current;
|
|
1056
1051
|
} else {
|
|
1057
|
-
currentWidth =
|
|
1058
|
-
currentHeight =
|
|
1052
|
+
currentWidth = height_7 * refs.aspectRatio.current;
|
|
1053
|
+
currentHeight = height_7;
|
|
1059
1054
|
}
|
|
1060
1055
|
} else {
|
|
1061
|
-
currentWidth =
|
|
1062
|
-
currentHeight =
|
|
1056
|
+
currentWidth = width_5;
|
|
1057
|
+
currentHeight = height_7;
|
|
1063
1058
|
}
|
|
1064
1059
|
if (keepAspectRatio) {
|
|
1065
|
-
if (
|
|
1066
|
-
if (
|
|
1060
|
+
if (width_5 < 0 && currentWidth > 0 || width_5 > 0 && currentWidth < 0) currentWidth *= -1;
|
|
1061
|
+
if (height_7 < 0 && currentHeight > 0 || height_7 > 0 && currentHeight < 0) currentHeight *= -1;
|
|
1067
1062
|
}
|
|
1068
|
-
|
|
1069
|
-
|
|
1063
|
+
item_20.p = [startTransformed_0.x, startTransformed_0.y];
|
|
1064
|
+
item_20.ar = [currentWidth, currentHeight];
|
|
1070
1065
|
}
|
|
1071
1066
|
|
|
1072
1067
|
// select box
|
|
@@ -1074,49 +1069,49 @@ const Whiteboard = /*#__PURE__*/_react.default.forwardRef((props_, ref) => {
|
|
|
1074
1069
|
|
|
1075
1070
|
// render
|
|
1076
1071
|
render();
|
|
1077
|
-
}
|
|
1078
|
-
const onMouseMove =
|
|
1072
|
+
};
|
|
1073
|
+
const onMouseMove = event_5 => {
|
|
1079
1074
|
const {
|
|
1080
|
-
offsetX,
|
|
1081
|
-
offsetY,
|
|
1082
|
-
clientX,
|
|
1083
|
-
clientY
|
|
1084
|
-
} =
|
|
1075
|
+
offsetX: offsetX_2,
|
|
1076
|
+
offsetY: offsetY_2,
|
|
1077
|
+
clientX: clientX_3,
|
|
1078
|
+
clientY: clientY_3
|
|
1079
|
+
} = event_5;
|
|
1085
1080
|
onMove({
|
|
1086
|
-
offsetX,
|
|
1087
|
-
offsetY,
|
|
1088
|
-
clientX,
|
|
1089
|
-
clientY
|
|
1090
|
-
},
|
|
1091
|
-
}
|
|
1092
|
-
const onTouchMove =
|
|
1081
|
+
offsetX: offsetX_2,
|
|
1082
|
+
offsetY: offsetY_2,
|
|
1083
|
+
clientX: clientX_3,
|
|
1084
|
+
clientY: clientY_3
|
|
1085
|
+
}, event_5);
|
|
1086
|
+
};
|
|
1087
|
+
const onTouchMove = event_6 => {
|
|
1093
1088
|
// Get the first touch point
|
|
1094
|
-
const
|
|
1089
|
+
const touch_0 = event_6.touches[0];
|
|
1095
1090
|
const {
|
|
1096
|
-
clientX,
|
|
1097
|
-
clientY
|
|
1098
|
-
} =
|
|
1091
|
+
clientX: clientX_4,
|
|
1092
|
+
clientY: clientY_4
|
|
1093
|
+
} = touch_0;
|
|
1099
1094
|
let {
|
|
1100
|
-
offsetX,
|
|
1101
|
-
offsetY
|
|
1102
|
-
} =
|
|
1103
|
-
const
|
|
1104
|
-
if (
|
|
1095
|
+
offsetX: offsetX_3,
|
|
1096
|
+
offsetY: offsetY_3
|
|
1097
|
+
} = touch_0;
|
|
1098
|
+
const targetElement_0 = touch_0.target;
|
|
1099
|
+
if (targetElement_0 instanceof HTMLElement) {
|
|
1105
1100
|
// Get the bounding rectangle of the target element
|
|
1106
|
-
const
|
|
1101
|
+
const rect_2 = targetElement_0.getBoundingClientRect();
|
|
1107
1102
|
|
|
1108
1103
|
// Calculate the offsetX and offsetY
|
|
1109
|
-
|
|
1110
|
-
|
|
1104
|
+
offsetX_3 = touch_0.clientX - rect_2.left;
|
|
1105
|
+
offsetY_3 = touch_0.clientY - rect_2.top;
|
|
1111
1106
|
}
|
|
1112
1107
|
onMove({
|
|
1113
|
-
offsetX,
|
|
1114
|
-
offsetY,
|
|
1115
|
-
clientX,
|
|
1116
|
-
clientY
|
|
1117
|
-
},
|
|
1118
|
-
}
|
|
1119
|
-
const undo =
|
|
1108
|
+
offsetX: offsetX_3,
|
|
1109
|
+
offsetY: offsetY_3,
|
|
1110
|
+
clientX: clientX_4,
|
|
1111
|
+
clientY: clientY_4
|
|
1112
|
+
}, event_6);
|
|
1113
|
+
};
|
|
1114
|
+
const undo = () => {
|
|
1120
1115
|
if (!refs.undo.current.length) return;
|
|
1121
1116
|
|
|
1122
1117
|
// add current state to redo
|
|
@@ -1127,8 +1122,8 @@ const Whiteboard = /*#__PURE__*/_react.default.forwardRef((props_, ref) => {
|
|
|
1127
1122
|
|
|
1128
1123
|
// render
|
|
1129
1124
|
render();
|
|
1130
|
-
}
|
|
1131
|
-
const redo =
|
|
1125
|
+
};
|
|
1126
|
+
const redo = () => {
|
|
1132
1127
|
if (!refs.redo.current.length) return;
|
|
1133
1128
|
|
|
1134
1129
|
// add current state to undo
|
|
@@ -1139,17 +1134,17 @@ const Whiteboard = /*#__PURE__*/_react.default.forwardRef((props_, ref) => {
|
|
|
1139
1134
|
|
|
1140
1135
|
// render
|
|
1141
1136
|
render();
|
|
1142
|
-
}
|
|
1143
|
-
const onWheel =
|
|
1144
|
-
const
|
|
1137
|
+
};
|
|
1138
|
+
const onWheel = eventReact_1 => {
|
|
1139
|
+
const event_7 = eventReact_1.nativeEvent;
|
|
1145
1140
|
|
|
1146
1141
|
// zoom
|
|
1147
|
-
if (
|
|
1142
|
+
if (event_7.metaKey || event_7.ctrlKey) {
|
|
1148
1143
|
setTool('zoom');
|
|
1149
1144
|
refs.toolUpdateAuto.current = true;
|
|
1150
1145
|
const zoomFactor = 1.054;
|
|
1151
|
-
const mouseX =
|
|
1152
|
-
const mouseY =
|
|
1146
|
+
const mouseX = event_7.offsetX;
|
|
1147
|
+
const mouseY = event_7.offsetY;
|
|
1153
1148
|
const scale = refs.scale.current;
|
|
1154
1149
|
|
|
1155
1150
|
// Convert mouse position to canvas coordinates
|
|
@@ -1157,7 +1152,7 @@ const Whiteboard = /*#__PURE__*/_react.default.forwardRef((props_, ref) => {
|
|
|
1157
1152
|
const canvasY = (mouseY - refs.move.current.y) / scale;
|
|
1158
1153
|
|
|
1159
1154
|
// Adjust scale
|
|
1160
|
-
const zoomIn =
|
|
1155
|
+
const zoomIn = event_7.deltaY < 0;
|
|
1161
1156
|
const newScale = zoomIn ? scale * zoomFactor : scale / zoomFactor;
|
|
1162
1157
|
if (newScale <= maxZoom / 100 && newScale >= minZoom / 100) {
|
|
1163
1158
|
// Update origin to focus on mouse position
|
|
@@ -1169,22 +1164,22 @@ const Whiteboard = /*#__PURE__*/_react.default.forwardRef((props_, ref) => {
|
|
|
1169
1164
|
}
|
|
1170
1165
|
// pan
|
|
1171
1166
|
else if (!refs.mouseDown.current) {
|
|
1172
|
-
refs.move.current.x -=
|
|
1173
|
-
refs.move.current.y -=
|
|
1167
|
+
refs.move.current.x -= event_7.deltaX;
|
|
1168
|
+
refs.move.current.y -= event_7.deltaY;
|
|
1174
1169
|
render();
|
|
1175
1170
|
}
|
|
1176
|
-
}
|
|
1177
|
-
const onPaste =
|
|
1178
|
-
|
|
1171
|
+
};
|
|
1172
|
+
const onPaste = event_8 => {
|
|
1173
|
+
event_8.preventDefault();
|
|
1179
1174
|
|
|
1180
1175
|
// Get clipboard data
|
|
1181
|
-
const
|
|
1176
|
+
const items_6 = Array.from(event_8.clipboardData.items);
|
|
1182
1177
|
|
|
1183
1178
|
// Loop through clipboard items to find an image
|
|
1184
|
-
for (const
|
|
1185
|
-
if (
|
|
1179
|
+
for (const item_21 of items_6) {
|
|
1180
|
+
if (item_21.type.startsWith('image/')) {
|
|
1186
1181
|
// Get the image file
|
|
1187
|
-
const blob =
|
|
1182
|
+
const blob = item_21.getAsFile();
|
|
1188
1183
|
refs.image.current = new Image();
|
|
1189
1184
|
|
|
1190
1185
|
// Load the image and draw it on the canvas
|
|
@@ -1195,7 +1190,7 @@ const Whiteboard = /*#__PURE__*/_react.default.forwardRef((props_, ref) => {
|
|
|
1195
1190
|
// 1) Upload the image first, than read it in image src
|
|
1196
1191
|
// 2) Add url of the image
|
|
1197
1192
|
// instead of embeding the image
|
|
1198
|
-
const
|
|
1193
|
+
const item__2 = {
|
|
1199
1194
|
i: (0, _utils.getID)(),
|
|
1200
1195
|
v: 'i',
|
|
1201
1196
|
p: [],
|
|
@@ -1208,7 +1203,7 @@ const Whiteboard = /*#__PURE__*/_react.default.forwardRef((props_, ref) => {
|
|
|
1208
1203
|
},
|
|
1209
1204
|
a: _date.OnesyDate.milliseconds
|
|
1210
1205
|
};
|
|
1211
|
-
add(
|
|
1206
|
+
add(item__2);
|
|
1212
1207
|
setTool('image');
|
|
1213
1208
|
};
|
|
1214
1209
|
|
|
@@ -1217,139 +1212,139 @@ const Whiteboard = /*#__PURE__*/_react.default.forwardRef((props_, ref) => {
|
|
|
1217
1212
|
break;
|
|
1218
1213
|
}
|
|
1219
1214
|
}
|
|
1220
|
-
}
|
|
1215
|
+
};
|
|
1221
1216
|
_react.default.useEffect(() => {
|
|
1222
1217
|
const method = () => {
|
|
1223
|
-
const
|
|
1224
|
-
const
|
|
1218
|
+
const width_6 = refs.root.current.offsetWidth;
|
|
1219
|
+
const height_8 = refs.root.current.offsetHeight;
|
|
1225
1220
|
setSize({
|
|
1226
|
-
width,
|
|
1227
|
-
height
|
|
1221
|
+
width: width_6,
|
|
1222
|
+
height: height_8
|
|
1228
1223
|
});
|
|
1229
1224
|
};
|
|
1230
|
-
const onKeyUp =
|
|
1225
|
+
const onKeyUp = event_9 => {
|
|
1231
1226
|
if (refs.toolUpdateAuto.current) setTool(refs.previousTool.current || 'pen');
|
|
1232
1227
|
};
|
|
1233
|
-
const onKeyDown = async
|
|
1228
|
+
const onKeyDown = async event_10 => {
|
|
1234
1229
|
refs.toolUpdateAuto.current = false;
|
|
1235
1230
|
const {
|
|
1236
|
-
key
|
|
1237
|
-
} =
|
|
1231
|
+
key: key_0
|
|
1232
|
+
} = event_10;
|
|
1238
1233
|
const itemsAll = [...refs.items.current].filter(Boolean);
|
|
1239
|
-
const
|
|
1240
|
-
const
|
|
1241
|
-
if (['a', 'A'].includes(
|
|
1242
|
-
|
|
1234
|
+
const t_1 = refs.tool.current;
|
|
1235
|
+
const zoom_3 = refs.scale.current;
|
|
1236
|
+
if (['a', 'A'].includes(key_0) && (event_10.metaKey || event_10.ctrlKey)) {
|
|
1237
|
+
event_10.preventDefault();
|
|
1243
1238
|
selectAll();
|
|
1244
1239
|
render();
|
|
1245
|
-
} else if (
|
|
1246
|
-
const
|
|
1247
|
-
if (
|
|
1248
|
-
if (
|
|
1249
|
-
if (
|
|
1250
|
-
if (
|
|
1251
|
-
if (
|
|
1252
|
-
const
|
|
1253
|
-
refs.items.current.forEach(
|
|
1254
|
-
if (
|
|
1240
|
+
} else if (t_1 === 'select' && ['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight', 'Backspace'].includes(key_0)) {
|
|
1241
|
+
const value_0 = event_10.shiftKey ? 10 : 1;
|
|
1242
|
+
if (key_0 === 'ArrowUp') onMoveItems(0, -value_0 / zoom_3);
|
|
1243
|
+
if (key_0 === 'ArrowDown') onMoveItems(0, value_0 / zoom_3);
|
|
1244
|
+
if (key_0 === 'ArrowLeft') onMoveItems(-value_0 / zoom_3, 0);
|
|
1245
|
+
if (key_0 === 'ArrowRight') onMoveItems(value_0 / zoom_3, 0);
|
|
1246
|
+
if (key_0 === 'Backspace') {
|
|
1247
|
+
const toRemove_2 = [];
|
|
1248
|
+
refs.items.current.forEach(item_22 => {
|
|
1249
|
+
if (item_22.se) toRemove_2.push(item_22);
|
|
1255
1250
|
});
|
|
1256
|
-
if (
|
|
1251
|
+
if (toRemove_2.length) remove(toRemove_2);
|
|
1257
1252
|
}
|
|
1258
1253
|
render();
|
|
1259
|
-
} else if (
|
|
1254
|
+
} else if (key_0 === 'Escape') {
|
|
1260
1255
|
setTool('select');
|
|
1261
1256
|
refs.textActive.current = null;
|
|
1262
1257
|
unselectAll();
|
|
1263
1258
|
filterItems();
|
|
1264
1259
|
render();
|
|
1265
1260
|
} else if (tool === 'text') {
|
|
1266
|
-
const selectedTextBox = itemsAll.find(
|
|
1261
|
+
const selectedTextBox = itemsAll.find(item_23 => item_23.v === 't' && item_23.se);
|
|
1267
1262
|
if (!selectedTextBox) return;
|
|
1268
1263
|
const {
|
|
1269
|
-
line,
|
|
1270
|
-
char
|
|
1264
|
+
line: line_2,
|
|
1265
|
+
char: char_0
|
|
1271
1266
|
} = selectedTextBox.s.cursor;
|
|
1272
|
-
const
|
|
1273
|
-
const
|
|
1274
|
-
if (['ArrowLeft', 'ArrowRight'].includes(
|
|
1275
|
-
var
|
|
1276
|
-
|
|
1277
|
-
selectedTextBox.s.cursor.char +=
|
|
1267
|
+
const lines_0 = selectedTextBox.s.lines;
|
|
1268
|
+
const currentLine_0 = lines_0[line_2];
|
|
1269
|
+
if (['ArrowLeft', 'ArrowRight'].includes(key_0)) {
|
|
1270
|
+
var _lines_0$line_, _lines_0$selectedText2;
|
|
1271
|
+
event_10.preventDefault();
|
|
1272
|
+
selectedTextBox.s.cursor.char += key_0 === 'ArrowLeft' ? -1 : 1;
|
|
1278
1273
|
if (selectedTextBox.s.cursor.char < 0) {
|
|
1279
|
-
var
|
|
1274
|
+
var _lines_0$selectedText;
|
|
1280
1275
|
selectedTextBox.s.cursor.line--;
|
|
1281
|
-
selectedTextBox.s.cursor.char = (
|
|
1282
|
-
} else if (selectedTextBox.s.cursor.char > ((
|
|
1276
|
+
selectedTextBox.s.cursor.char = (_lines_0$selectedText = lines_0[selectedTextBox.s.cursor.line]) === null || _lines_0$selectedText === void 0 ? void 0 : _lines_0$selectedText.length;
|
|
1277
|
+
} else if (selectedTextBox.s.cursor.char > ((_lines_0$line_ = lines_0[line_2]) === null || _lines_0$line_ === void 0 ? void 0 : _lines_0$line_.length) && line_2 !== lines_0.length - 1) {
|
|
1283
1278
|
selectedTextBox.s.cursor.line++;
|
|
1284
1279
|
selectedTextBox.s.cursor.char = 0;
|
|
1285
1280
|
}
|
|
1286
|
-
selectedTextBox.s.cursor.line = (0, _utils.clamp)(selectedTextBox.s.cursor.line, 0,
|
|
1287
|
-
selectedTextBox.s.cursor.char = (0, _utils.clamp)(selectedTextBox.s.cursor.char, 0, (
|
|
1281
|
+
selectedTextBox.s.cursor.line = (0, _utils.clamp)(selectedTextBox.s.cursor.line, 0, lines_0.length - 1);
|
|
1282
|
+
selectedTextBox.s.cursor.char = (0, _utils.clamp)(selectedTextBox.s.cursor.char, 0, (_lines_0$selectedText2 = lines_0[selectedTextBox.s.cursor.line]) === null || _lines_0$selectedText2 === void 0 ? void 0 : _lines_0$selectedText2.length);
|
|
1288
1283
|
}
|
|
1289
|
-
if (['ArrowUp', 'ArrowDown'].includes(
|
|
1290
|
-
var
|
|
1291
|
-
|
|
1292
|
-
selectedTextBox.s.cursor.line +=
|
|
1293
|
-
selectedTextBox.s.cursor.line = (0, _utils.clamp)(selectedTextBox.s.cursor.line, 0,
|
|
1294
|
-
selectedTextBox.s.cursor.char = (0, _utils.clamp)(selectedTextBox.s.cursor.char, 0, (
|
|
1295
|
-
} else if (
|
|
1296
|
-
|
|
1297
|
-
const newLine =
|
|
1298
|
-
|
|
1299
|
-
|
|
1284
|
+
if (['ArrowUp', 'ArrowDown'].includes(key_0)) {
|
|
1285
|
+
var _lines_0$selectedText3;
|
|
1286
|
+
event_10.preventDefault();
|
|
1287
|
+
selectedTextBox.s.cursor.line += key_0 === 'ArrowUp' ? -1 : 1;
|
|
1288
|
+
selectedTextBox.s.cursor.line = (0, _utils.clamp)(selectedTextBox.s.cursor.line, 0, lines_0.length - 1);
|
|
1289
|
+
selectedTextBox.s.cursor.char = (0, _utils.clamp)(selectedTextBox.s.cursor.char, 0, (_lines_0$selectedText3 = lines_0[selectedTextBox.s.cursor.line]) === null || _lines_0$selectedText3 === void 0 ? void 0 : _lines_0$selectedText3.length);
|
|
1290
|
+
} else if (key_0 === 'Enter') {
|
|
1291
|
+
event_10.preventDefault();
|
|
1292
|
+
const newLine = currentLine_0.slice(char_0);
|
|
1293
|
+
lines_0[line_2] = currentLine_0.slice(0, char_0);
|
|
1294
|
+
lines_0.splice(line_2 + 1, 0, newLine);
|
|
1300
1295
|
selectedTextBox.s.cursor.line++;
|
|
1301
1296
|
selectedTextBox.s.cursor.char = 0;
|
|
1302
|
-
} else if (
|
|
1303
|
-
|
|
1304
|
-
if (
|
|
1305
|
-
|
|
1297
|
+
} else if (key_0 === 'Backspace') {
|
|
1298
|
+
event_10.preventDefault();
|
|
1299
|
+
if (char_0 > 0) {
|
|
1300
|
+
lines_0[line_2] = currentLine_0.slice(0, char_0 - 1) + currentLine_0.slice(char_0);
|
|
1306
1301
|
selectedTextBox.s.cursor.char--;
|
|
1307
|
-
} else if (
|
|
1308
|
-
const prevLine =
|
|
1302
|
+
} else if (line_2 > 0) {
|
|
1303
|
+
const prevLine = lines_0[line_2 - 1];
|
|
1309
1304
|
selectedTextBox.s.cursor.char = prevLine.length;
|
|
1310
|
-
|
|
1311
|
-
|
|
1305
|
+
lines_0[line_2 - 1] += lines_0[line_2];
|
|
1306
|
+
lines_0.splice(line_2, 1);
|
|
1312
1307
|
selectedTextBox.s.cursor.line--;
|
|
1313
1308
|
}
|
|
1314
|
-
} else if (
|
|
1315
|
-
if ([' '].includes(
|
|
1309
|
+
} else if (key_0.length === 1) {
|
|
1310
|
+
if ([' '].includes(key_0)) event_10.preventDefault();
|
|
1316
1311
|
let textClipboard = '';
|
|
1317
|
-
const isPaste = (
|
|
1312
|
+
const isPaste = (event_10.ctrlKey || event_10.metaKey) && ['v', 'V'].includes(key_0);
|
|
1318
1313
|
if (isPaste) {
|
|
1319
1314
|
try {
|
|
1320
1315
|
textClipboard = await window.navigator.clipboard.readText();
|
|
1321
1316
|
} catch (error) {}
|
|
1322
1317
|
}
|
|
1323
|
-
const text = isPaste ? textClipboard :
|
|
1324
|
-
selectedTextBox.s.lines[
|
|
1318
|
+
const text = isPaste ? textClipboard : key_0;
|
|
1319
|
+
selectedTextBox.s.lines[line_2] = currentLine_0.slice(0, char_0) + text + currentLine_0.slice(char_0);
|
|
1325
1320
|
selectedTextBox.s.cursor.char += text.length;
|
|
1326
1321
|
}
|
|
1327
1322
|
updateTextBoxDimensions(selectedTextBox);
|
|
1328
1323
|
selectedTextBox.c = [...selectedTextBox.p, ...selectedTextBox.ar];
|
|
1329
1324
|
render();
|
|
1330
1325
|
} else {
|
|
1331
|
-
if (
|
|
1332
|
-
if (
|
|
1326
|
+
if (event_10.metaKey && key_0 === 'z') {
|
|
1327
|
+
if (event_10.shiftKey) redo();else undo();
|
|
1333
1328
|
}
|
|
1334
|
-
if (
|
|
1329
|
+
if (key_0 === ' ') {
|
|
1335
1330
|
refs.toolUpdateAuto.current = true;
|
|
1336
1331
|
setTool('pan');
|
|
1337
1332
|
}
|
|
1338
1333
|
|
|
1339
1334
|
// tools
|
|
1340
|
-
if (
|
|
1341
|
-
if (['E', 'D', 'P', 'S', 'C', 'R', 'I', 'L', 'A', 'T', 'G'].includes(
|
|
1342
|
-
if (
|
|
1343
|
-
if (
|
|
1344
|
-
if (
|
|
1345
|
-
if (
|
|
1346
|
-
if (
|
|
1347
|
-
if (
|
|
1348
|
-
if (
|
|
1349
|
-
if (
|
|
1350
|
-
if (
|
|
1351
|
-
if (
|
|
1352
|
-
if (
|
|
1335
|
+
if (event_10.shiftKey) {
|
|
1336
|
+
if (['E', 'D', 'P', 'S', 'C', 'R', 'I', 'L', 'A', 'T', 'G'].includes(key_0)) refs.toolUpdateAuto.current = false;
|
|
1337
|
+
if (key_0 === 'E') setTool('eraser');
|
|
1338
|
+
if (key_0 === 'D') setTool('pen');
|
|
1339
|
+
if (key_0 === 'P') setTool('pan');
|
|
1340
|
+
if (key_0 === 'S') setTool('select');
|
|
1341
|
+
if (key_0 === 'C') setTool('circle');
|
|
1342
|
+
if (key_0 === 'R') setTool('rectangle');
|
|
1343
|
+
if (key_0 === 'I') setTool('triangle');
|
|
1344
|
+
if (key_0 === 'L') setTool('line');
|
|
1345
|
+
if (key_0 === 'A') setTool('line-arrow');
|
|
1346
|
+
if (key_0 === 'T') setTool('text');
|
|
1347
|
+
if (key_0 === 'G') {
|
|
1353
1348
|
setGrid(previous => !previous);
|
|
1354
1349
|
render();
|
|
1355
1350
|
}
|
|
@@ -1377,20 +1372,20 @@ const Whiteboard = /*#__PURE__*/_react.default.forwardRef((props_, ref) => {
|
|
|
1377
1372
|
window.document.removeEventListener('paste', onPaste);
|
|
1378
1373
|
};
|
|
1379
1374
|
}, []);
|
|
1380
|
-
const onChangeInputFile =
|
|
1381
|
-
const file =
|
|
1375
|
+
const onChangeInputFile = event_11 => {
|
|
1376
|
+
const file = event_11.target.files[0];
|
|
1382
1377
|
if (file) {
|
|
1383
1378
|
const reader = new FileReader();
|
|
1384
1379
|
reader.onload = eventReader => {
|
|
1385
1380
|
refs.image.current = new Image();
|
|
1386
1381
|
refs.image.current.src = eventReader.target.result;
|
|
1387
1382
|
refs.toolUpdateAuto.current = true;
|
|
1388
|
-
|
|
1383
|
+
event_11.target.value = '';
|
|
1389
1384
|
setTool('image');
|
|
1390
1385
|
};
|
|
1391
1386
|
reader.readAsDataURL(file);
|
|
1392
1387
|
}
|
|
1393
|
-
}
|
|
1388
|
+
};
|
|
1394
1389
|
const propsCanvas = {
|
|
1395
1390
|
width: size.width,
|
|
1396
1391
|
height: size.height,
|
|
@@ -1401,11 +1396,11 @@ const Whiteboard = /*#__PURE__*/_react.default.forwardRef((props_, ref) => {
|
|
|
1401
1396
|
}
|
|
1402
1397
|
};
|
|
1403
1398
|
return /*#__PURE__*/_react.default.createElement(Line, (0, _extends2.default)({
|
|
1404
|
-
ref:
|
|
1399
|
+
ref: item_24 => {
|
|
1405
1400
|
if (ref) {
|
|
1406
|
-
if ((0, _utils.is)('function', ref)) ref(
|
|
1401
|
+
if ((0, _utils.is)('function', ref)) ref(item_24);else ref.current = item_24;
|
|
1407
1402
|
}
|
|
1408
|
-
refs.root.current =
|
|
1403
|
+
refs.root.current = item_24;
|
|
1409
1404
|
},
|
|
1410
1405
|
flex: true,
|
|
1411
1406
|
fullWidth: true,
|