import styled from "@emotion/styled"; import { inject, observer } from "mobx-react"; import React, { useRef } from "react"; import { LIGHT_TERTIARY_ONE } from "../../../shared/colors"; import { SlideRectangle } from "../../../shared/types"; import { generateRandomColor } from "../../../shared/utils/utils"; import { StoreProps } from "../../platform/SlideshowStore"; import withPlatform, { PlatformProps } from "../../platform/withPlatform"; import Resizer from "./Resizer"; import { CurrentScreen, getCanvasPosition } from "./windowListeners"; type Props = { slideRectangle: SlideRectangle; } & PlatformProps & StoreProps; function SlideObjectRectangle(props: Props) { const rectangleRef = useRef(null); const userOfSelectedElement = props.store.subscriberSelectedElements.get( props.slideRectangle.id ); return (
{ props.store.setSelectedSlideElement(props.slideRectangle.id); e.stopPropagation(); }} onMouseDown={(e) => { if ( props.store.selectedSlideElement.get() === props.slideRectangle.id ) { const canvasPosition = getCanvasPosition(e, props.store); CurrentScreen.canvasX = canvasPosition.x; CurrentScreen.canvasY = canvasPosition.y; CurrentScreen.screenX = e.screenX; CurrentScreen.screenY = e.screenY; props.store.currentDragElement.set(props.slideRectangle.id); } }} onMouseMove={(e) => {}} onMouseUp={(e) => {}} /> ); } export default withPlatform(inject("store")(observer(SlideObjectRectangle))); const Container = styled.div``;