11import { DraggableValue } from '../components/DraggableValue' ;
2- import { IOutlet , DataType } from '../core/IOutlet' ;
2+ import { IOutlet , DataType , DataTypes } from '../core/IOutlet' ;
33import { Script } from '../export/Script' ;
44import { Layout , Row } from '../layout/Layout' ;
55import { BasicInputProperty } from './BasicInputProperty' ;
@@ -60,12 +60,10 @@ export class InputOrValue extends BasicInputProperty {
6060 this . valueSlider . value = valConfig . defaultValue ;
6161
6262 this . addEventListener ( 'typeChange' , ( ev ) => {
63- if ( ev . newType ?. size > 1 ) {
63+ if ( this . connectedTo ) {
6464 this . layout = undefined ;
6565 } else {
66- if ( ! this . layout && ! this . connectedTo ) {
67- this . layout = this . notConnectedContent ;
68- }
66+ this . layout = this . notConnectedContent ;
6967 }
7068 } ) ;
7169 }
@@ -109,7 +107,6 @@ export class InputOrValue extends BasicInputProperty {
109107
110108 protected override onConnected ( to : IOutlet ) : void {
111109 if ( ! this . multiplyInputWithValue ) this . layout = undefined ;
112-
113110 this . onChange ?.( ) ;
114111 }
115112
@@ -120,10 +117,18 @@ export class InputOrValue extends BasicInputProperty {
120117 this . onChange ?.( this . layout ? this . valueSlider . value : undefined ) ;
121118 }
122119
123- override writeScript ( script : Script ) : string {
124- script . importModule ( 'float' ) ;
120+ override writeScript ( script : Script ) : string {
121+
122+ const typeName = DataTypes . find ( dt => dt . type == this . type ) ! . name ;
125123
126- const val = `float(${ this . valueSlider . stringValue } )` ;
124+ script . importModule ( typeName ) ;
125+
126+ const valValue = this . valueSlider . stringValue ;
127+
128+ const values = new Array ( this . type . size ) . fill ( valValue ) ;
129+
130+ const val = `${ typeName } (${ values . join ( ',' ) } )` ;
131+
127132
128133 if ( this . connectedTo ) {
129134 const inputValue = this . connectedTo . writeScript ( script ) ;
0 commit comments