This repository has been archived by the owner on Oct 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 224
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf: remove heftiest drag/mouseover performance cliffs
- Loading branch information
Showing
10 changed files
with
117 additions
and
184 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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import * as Components from '../../components'; | ||
import { ElementContentContainer } from './element-content-container'; | ||
import * as MobxReact from 'mobx-react'; | ||
import * as Model from '../../model'; | ||
import * as React from 'react'; | ||
|
||
export interface ElementContainerProps { | ||
element: Model.Element; | ||
} | ||
|
||
@MobxReact.observer | ||
export class ElementContainer extends React.Component<ElementContainerProps> { | ||
public render(): JSX.Element | null { | ||
const { props } = this; | ||
return ( | ||
<Components.Element | ||
active={props.element.getSelected()} | ||
draggable={true} | ||
dragging={true} | ||
editable={props.element.isNameEditable()} | ||
highlight={props.element.getHighlighted()} | ||
highlightPlaceholder={props.element.getPlaceholderHighlighted()} | ||
id={props.element.getId()} | ||
mayOpen={props.element.acceptsChildren()} | ||
open={ | ||
props.element.getOpen() || props.element.getDescendants().some(e => e.getSelected()) | ||
} | ||
title={props.element.getName()} | ||
> | ||
{props.element.getOpen() | ||
? props.element | ||
.getContents() | ||
.map(content => ( | ||
<ElementContentContainer key={content.getId()} content={content} /> | ||
)) | ||
: []} | ||
</Components.Element> | ||
); | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { ElementContainer } from './element-container'; | ||
import * as MobxReact from 'mobx-react'; | ||
import * as Model from '../../model'; | ||
import * as React from 'react'; | ||
|
||
export interface ElementContentContainerProps { | ||
content: Model.ElementContent; | ||
} | ||
|
||
@MobxReact.observer | ||
export class ElementContentContainer extends React.Component<ElementContentContainerProps> { | ||
public render(): JSX.Element | null { | ||
const { props } = this; | ||
return ( | ||
<div> | ||
{props.content | ||
.getElements() | ||
.map(element => <ElementContainer key={element.getId()} element={element} />)} | ||
</div> | ||
); | ||
} | ||
} |
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 was deleted.
Oops, something went wrong.
Oops, something went wrong.