@@ -5,6 +5,7 @@ import clsx from 'clsx';
55import { faRotateLeft } from '@fortawesome/free-solid-svg-icons' ;
66
77import { AwesomeIcon } from '../AwesomeIcon' ;
8+ import CopyToClipboardButton from '../CopyToClipboardButton' ;
89import BooleanWidget from '../widgets/BooleanWidget' ;
910import ColorWidget from '../widgets/ColorWidget' ;
1011import InputWidget from '../widgets/InputWidget' ;
@@ -16,6 +17,9 @@ import Vec3Widget from '../widgets/Vec3Widget';
1617import Vec2Widget from '../widgets/Vec2Widget' ;
1718import { updateEntity } from '../../lib/entity' ;
1819import { equal } from '../../lib/utils' ;
20+ import { getComponentClipboardRepresentation } from '../../lib/entity' ;
21+
22+ const COPYABLE_COMPONENTS = [ 'position' , 'rotation' , 'scale' ] ;
1923
2024export default class PropertyRow extends React . Component {
2125 static propTypes = {
@@ -212,10 +216,28 @@ export default class PropertyRow extends React.Component {
212216 { props . name }
213217 </ label >
214218 { this . getWidget ( ) }
215- { isPropertyExplicitlySet && type !== 'map' && (
219+ < div className = "propertyRow-actions" >
220+ { type === 'vec3' &&
221+ COPYABLE_COMPONENTS . includes ( props . componentname ) && (
222+ < CopyToClipboardButton
223+ title = "Copy to clipboard"
224+ message = "Copied to clipboard"
225+ text = { ( ) =>
226+ getComponentClipboardRepresentation (
227+ props . entity ,
228+ props . componentname
229+ )
230+ }
231+ />
232+ ) }
216233 < button
217234 className = "reset-button"
218235 title = "Reset"
236+ style = {
237+ ! ( isPropertyExplicitlySet && type !== 'map' )
238+ ? { visibility : 'hidden' }
239+ : null
240+ }
219241 onClick = { ( ) => {
220242 updateEntity (
221243 props . entity ,
@@ -227,7 +249,7 @@ export default class PropertyRow extends React.Component {
227249 >
228250 < AwesomeIcon icon = { faRotateLeft } />
229251 </ button >
230- ) }
252+ </ div >
231253 </ div >
232254 ) ;
233255 }
0 commit comments