-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
We push all state changes through Replicache to gain access to its conflict resolution. If another client is moving an object at the same time, we should merge their movements, or something otherwise reasonable should happen. Replicache is not yet optimized for this type of usage - all writes go to disk. So it's not very pretty right now, but it's correct. Will fix Replicache subsequently.
- Loading branch information
Showing
3 changed files
with
79 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,17 @@ | ||
import React from 'react'; | ||
import React, { MouseEventHandler } from 'react'; | ||
import {Data} from '../data'; | ||
import {getObjectAttributes} from './attribs'; | ||
|
||
export function Rect2({data, id, onMouseEnter}: {data: Data, id: string, onMouseEnter: () => void}) { | ||
export function Rect2( | ||
{data, id, onMouseEnter}: { | ||
data: Data, | ||
id: string, | ||
onMouseEnter: MouseEventHandler | ||
}) | ||
{ | ||
const shape = data.useShapeByID(id); | ||
if (!shape) { | ||
return null; | ||
} | ||
return <rect {...{...getObjectAttributes(shape), onMouseEnter}} />; | ||
return <rect {...{...getObjectAttributes(shape), className: 'shape', onMouseEnter}} />; | ||
} |