<commit_before><!DOCTYPE html>
<html>
  <head>
    <meta http-equiv='Content-Type' content='text/html; charset=utf-8'>
    <title>Test PopupMenu</title>
    <script src='../../era/era-debug.js'></script>
<style>
</style>
<script>

var app = new Ui.App();

var vbox = new Ui.VBox({ verticalAlign: 'center', horizontalAlign: 'center', spacing: 5 });
app.setContent(vbox);

var selectable = new Ui.Pressable();
vbox.append(selectable);

selectable.append(new Ui.Rectangle({ width: 50, height: 50, radius: 8, fill: 'lightgreen' }));
selectable.append(new Ui.Label({ text: 'click' }));

app.connect(selectable, 'press', function(item, x, y) {
	console.log('open the menu: '+x+'x'+y);
	popup.open(x, y);
//	popup.open(selectable);
});

var button = new Ui.Button({ text: 'open popup' });
vbox.append(button);
app.connect(button, 'press', function() {
	popup.open();
});

var popup;
popup = new Ui.Popup();
var vbox2 = new Ui.VBox({ spacing: 5, margin: 10 });
popup.setContent(vbox2);
vbox2.append(new Ui.Label({ text: 'bonjour' }));
vbox2.append(new Ui.Separator());
vbox2.append(new Ui.Label({ text: 'bonjour2' }));
vbox2.append(new Ui.Separator());
vbox2.append(new Ui.Label({ text: 'bonjour3' }));
vbox2.append(new Ui.Separator());
vbox2.append(new Ui.Button({ text: 'click me' }));
vbox2.append(new Ui.Separator());
button = new Ui.Button({ text: 'popup' });
vbox2.append(button);
app.connect(button, 'press', function() {
	var newPopup = new Ui.Popup({ autoClose: true });
	var button = new Ui.Button({ text: 'click' });
	newPopup.setContent(button);
	newPopup.open();
});

button = new Ui.Button({ text: 'close popup' });
vbox.append(button);

app.connect(button, 'press', function() {
	popup.close();
});

var selectable2 = new Ui.Pressable();
vbox.append(selectable2);

selectable2.append(new Ui.Rectangle({ width: 50, height: 50, radius: 8, fill: 'lightgreen' }));
selectable2.append(new Ui.Label({ text: 'click' }));

app.connect(selectable2, 'press', function(item, x, y) {
	console.log('open the menu at element');
	popup.open(item, 'bottom');
});

</script>
  </head>
</html><commit_msg>let default position for popup menu<commit_after><!DOCTYPE html>
<html>
  <head>
    <meta http-equiv='Content-Type' content='text/html; charset=utf-8'>
    <title>Test PopupMenu</title>
    <script src='../../era/era-debug.js'></script>
<style>
</style>
<script>

var app = new Ui.App();

var vbox = new Ui.VBox({ verticalAlign: 'center', horizontalAlign: 'center', spacing: 5 });
app.setContent(vbox);

var selectable = new Ui.Pressable();
vbox.append(selectable);

selectable.append(new Ui.Rectangle({ width: 50, height: 50, radius: 8, fill: 'lightgreen' }));
selectable.append(new Ui.Label({ text: 'click' }));

app.connect(selectable, 'press', function(item, x, y) {
	console.log('open the menu: '+x+'x'+y);
	popup.open(x, y);
//	popup.open(selectable);
});

var button = new Ui.Button({ text: 'open popup' });
vbox.append(button);
app.connect(button, 'press', function() {
	popup.open();
});

var popup;
popup = new Ui.Popup();
var vbox2 = new Ui.VBox({ spacing: 5, margin: 10 });
popup.setContent(vbox2);
vbox2.append(new Ui.Label({ text: 'bonjour' }));
vbox2.append(new Ui.Separator());
vbox2.append(new Ui.Label({ text: 'bonjour2' }));
vbox2.append(new Ui.Separator());
vbox2.append(new Ui.Label({ text: 'bonjour3' }));
vbox2.append(new Ui.Separator());
vbox2.append(new Ui.Button({ text: 'click me' }));
vbox2.append(new Ui.Separator());
button = new Ui.Button({ text: 'popup' });
vbox2.append(button);
app.connect(button, 'press', function() {
	var newPopup = new Ui.Popup({ autoClose: true });
	var button = new Ui.Button({ text: 'click' });
	newPopup.setContent(button);
	newPopup.open();
});

button = new Ui.Button({ text: 'close popup' });
vbox.append(button);

app.connect(button, 'press', function() {
	popup.close();
});

var selectable2 = new Ui.Pressable();
vbox.append(selectable2);

selectable2.append(new Ui.Rectangle({ width: 50, height: 50, radius: 8, fill: 'lightgreen' }));
selectable2.append(new Ui.Label({ text: 'click' }));

app.connect(selectable2, 'press', function(item, x, y) {
	console.log('open the menu at element');
	popup.open(item);
});

</script>
  </head>
</html>
{'fraction_non_alphanumeric': 0.2073809523809524, 'fraction_numerical': 0.015714285714285715, 'mean_word_length': 5.279521674140509, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 31, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1970111', 'n_tokens_mistral': 1589, 'n_tokens_neox': 1577, 'n_words': 363}