@@ -23,10 +23,11 @@ import {
23
23
} from "./defaults" ;
24
24
25
25
interface Props {
26
- elements : Element [ ] ;
26
+ elements : Element [ ] ; // selected ones
27
+ allElements : Element [ ] ; // all of them
27
28
}
28
29
29
- export default function EditBar ( { elements } : Props ) {
30
+ export default function EditBar ( { elements, allElements } : Props ) {
30
31
const { actions } = useFrameContext ( ) ;
31
32
if ( elements . length == 0 ) return null ;
32
33
return (
@@ -44,7 +45,11 @@ export default function EditBar({ elements }: Props) {
44
45
< FontSize actions = { actions } elements = { elements } />
45
46
< ColorButton actions = { actions } elements = { elements } />
46
47
< DeleteButton actions = { actions } elements = { elements } />
47
- < OtherOperations actions = { actions } elements = { elements } />
48
+ < OtherOperations
49
+ actions = { actions }
50
+ elements = { elements }
51
+ allElements = { allElements }
52
+ />
48
53
</ div >
49
54
</ div >
50
55
) ;
@@ -225,13 +230,13 @@ function getFontFamily(elements: Element[]): string | undefined {
225
230
return DEFAULT_FONT_FAMILY ;
226
231
}
227
232
228
- function OtherOperations ( { actions, elements } : ButtonProps ) {
233
+ function OtherOperations ( { actions, elements, allElements } ) {
229
234
const frame = useFrameContext ( ) ;
230
235
const menu = (
231
236
< Menu
232
237
onClick = { ( { key } ) => {
233
238
if ( key == "bring-to-front" ) {
234
- const { zMax } = getPageSpan ( elements ) ;
239
+ const { zMax } = getPageSpan ( allElements ) ;
235
240
let z = zMax + 1 ;
236
241
for ( const element of elements ) {
237
242
actions . setElement ( { ...element , z } , false ) ;
@@ -240,9 +245,8 @@ function OtherOperations({ actions, elements }: ButtonProps) {
240
245
actions . syncstring_commit ( ) ;
241
246
actions . clearSelection ( frame . id ) ;
242
247
} else if ( key == "send-to-back" ) {
243
- const { zMin } = getPageSpan ( elements ) ;
248
+ const { zMin } = getPageSpan ( allElements ) ;
244
249
let z = zMin - 1 ;
245
- console . log ( "zMin = " , zMin , " z = " , z ) ;
246
250
for ( const element of elements ) {
247
251
actions . setElement ( { ...element , z } , false ) ;
248
252
z -= 1 ;
0 commit comments