@ -381,17 +381,10 @@ export class App extends React.Component<any, AppState> {
private renderSelectedShapeActions ( elements : readonly ExcalidrawElement [ ] ) {
private renderSelectedShapeActions ( elements : readonly ExcalidrawElement [ ] ) {
const { t } = this . props ;
const { t } = this . props ;
const { elementType , editingElement } = this . state ;
const { elementType , editingElement } = this . state ;
const selectedElements = elements . filter ( el = > el . isSelected ) ;
const targetElements = editingElement
const hasSelectedElements = selectedElements . length > 0 ;
? [ editingElement ]
const isTextToolSelected = elementType === "text" ;
: elements . filter ( el = > el . isSelected ) ;
const isShapeToolSelected = elementType !== "selection" ;
if ( ! targetElements . length && elementType === "selection" ) {
const isEditingText = editingElement && editingElement . type === "text" ;
if (
! hasSelectedElements &&
! isShapeToolSelected &&
! isTextToolSelected &&
! isEditingText
) {
return null ;
return null ;
}
}
@ -405,9 +398,8 @@ export class App extends React.Component<any, AppState> {
this . syncActionResult ,
this . syncActionResult ,
t ,
t ,
) }
) }
{ ( hasBackground ( elementType ) ||
{ ( hasBackground ( elements ) ||
targetElements . some ( element = > hasBackground ( element . type ) ) ) && (
( isShapeToolSelected && ! isTextToolSelected ) ) && (
< >
< >
{ this . actionManager . renderAction (
{ this . actionManager . renderAction (
"changeBackgroundColor" ,
"changeBackgroundColor" ,
@ -424,12 +416,11 @@ export class App extends React.Component<any, AppState> {
this . syncActionResult ,
this . syncActionResult ,
t ,
t ,
) }
) }
< hr / >
< / >
< / >
) }
) }
{ ( hasStroke ( element s ) ||
{ ( hasStroke ( element Type ) ||
( isShapeToolSelected && ! isTextToolSelected ) ) && (
targetElements . some ( element = > hasStroke ( element . type ) ) ) && (
< >
< >
{ this . actionManager . renderAction (
{ this . actionManager . renderAction (
"changeStrokeWidth" ,
"changeStrokeWidth" ,
@ -446,11 +437,11 @@ export class App extends React.Component<any, AppState> {
this . syncActionResult ,
this . syncActionResult ,
t ,
t ,
) }
) }
< hr / >
< / >
< / >
) }
) }
{ ( hasText ( elements ) || isTextToolSelected || isEditingText ) && (
{ ( hasText ( elementType ) ||
targetElements . some ( element = > hasText ( element . type ) ) ) && (
< >
< >
{ this . actionManager . renderAction (
{ this . actionManager . renderAction (
"changeFontSize" ,
"changeFontSize" ,
@ -467,7 +458,6 @@ export class App extends React.Component<any, AppState> {
this . syncActionResult ,
this . syncActionResult ,
t ,
t ,
) }
) }
< hr / >
< / >
< / >
) }
) }