0

I have developed a script and would like to publish it. I wanted to add dev notes, but can't find a good way to format the label such that it has a scroll wheel down. My script looks like this:

var longLabel = ui.Label('This is my very long label. I would like to be able to add line breaks to it so that it does not trail off infinitely to the right. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.' )
longLabel.style({
  width:'400px',
  height:'500px'
})
var panel = ui.Panel()
panel.style({
  width:'400px',
  height:'500px'
})
panel.add(longLabel)
Map.add(panel)

I would like the panel to have the width specifications in the script, but perhaps with line breaks partition the label text into a scrollable box.

1

The setting I was looking for was 'whiteSpace', which can be found in the ui.Panel.style(). As far as I know, the only options for this setting are 'nowrap', which makes it trail off, 'normal', which restricts it to the panel width, and 'pre', which I'm not entirely sure about.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.