lifeviewer bug

Has something gone haywire? Let us know about it!
rokicki
Posts: 80
Joined: August 6th, 2009, 12:26 pm

Re: lifeviewer bug

Post by rokicki » February 19th, 2024, 6:21 pm

LifeViewer does not work correctly in pages that use CSS scaling. (Ignore the fact that only part of the LifeViewer is visible; the controls on the canvas should still highlight properly when you mouse over them).

This would just be a "don't use CSS scaling" except that other JavaScript packages like reveal.js use css scaling to resize content for presentation.

Code: Select all

<!DOCTYPE html>
<html>
<head>
<meta name="LifeViewer" content="viewer textarea"> <!--required tag-->
<script src="lv-plugin.js"></script> <!--assumes plug-in is in the same directory as html file-->
</head>
<body>
<!--viewer container-->
<div class="viewer" style="scale: 1.1;"> <!--class=viewer is required-->
	<textarea>bo$2bo$3o!</textarea><br/> <!--textarea required in viewer container, with glider rle-->
	<canvas width=600 height=400></canvas> <!--canvas required in viewer container-->
</div>
<!--end viewer container-->
</body>
</html>
This also affects the reporting of coordinate locations as you mouse over them.

User avatar
rowett
Moderator
Posts: 3823
Joined: January 31st, 2013, 2:34 am
Location: UK
Contact:

Re: lifeviewer bug

Post by rowett » February 19th, 2024, 7:04 pm

rokicki wrote:
February 19th, 2024, 6:19 pm
LifeViewer does not appear to stop propagation of keyboard events (even ones it processes) which leads to issues when you embed a LifeViewer in another context (such as a reveal.js presentation).
Fixed in build 1109. Thanks for reporting!

User avatar
rowett
Moderator
Posts: 3823
Joined: January 31st, 2013, 2:34 am
Location: UK
Contact:

Re: lifeviewer bug

Post by rowett » February 19th, 2024, 7:57 pm

rokicki wrote:
February 19th, 2024, 6:21 pm
LifeViewer does not work correctly in pages that use CSS scaling.
This might be fixed in build 1110. Please let me know if it works in your browser.

rokicki
Posts: 80
Joined: August 6th, 2009, 12:26 pm

Re: lifeviewer bug

Post by rokicki » February 19th, 2024, 10:10 pm

It works in the small test case I posted, but unfortunately not when embedded into reveal.js. I'll dig into it more later
and try to come up with a resolution.

rokicki
Posts: 80
Joined: August 6th, 2009, 12:26 pm

Re: lifeviewer bug

Post by rokicki » February 19th, 2024, 10:14 pm

When there is more than one lifeviewer on a page, the updateMe() doesn't work.

In this test case, I've created two lifeviewers, each with a single pixel set. Then, on window load,
I put a *horizontal* bar of six pixels in the *top* and a *vertical* bar of six pixels in the *bottom*.

What happens in the browser is the *top* viewer gets the *vertical* bar, and the *bottom* viewer
stays with a single pixel.

(When I do the same thing in reveal.js, I get similar behavior sometimes, but sometimes the
LifeViewers never load or display and the window.onload errors out.)

I suspect there's some race condition?

This one is a bit of a showstopper for me . . .

Code: Select all

<!DOCTYPE html>
<html>
<head>
<meta name="LifeViewer" content="viewer textarea"> <!--required tag-->
<script src="lv-plugin.js"></script> <!--assumes plug-in is in the same directory as html file-->
<script>
   function update(id, dat) {
      var el = document.getElementById(id);
      el.innerHTML = dat;
      updateMe(el);
   }
   window.onload = function() {
      update('t1', 'oooooo');
      update('t2', 'o$o$o$o$o$o$');
   }
</script>
</head>
<body>
<!--viewer container-->
<div class="viewer"> <!--class=viewer is required-->
	<textarea id="t1">o!</textarea><br/> <!--textarea required in viewer container, with glider rle-->
	<canvas width=600 height=400></canvas> <!--canvas required in viewer container-->
</div>
<div class="viewer"> <!--class=viewer is required-->
	<textarea id="t2">o!</textarea><br/> <!--textarea required in viewer container, with glider rle-->
	<canvas width=600 height=400></canvas> <!--canvas required in viewer container-->
</div>
<!--end viewer container-->
</body>
</html>
More debugging of this: only the first viewer is ever updated, even if I add a button to the second viewer that calls updateMe(this).

(Edit). Not a showstopper; I just put my (rather large) RLE files inline and things work fine.

User avatar
rowett
Moderator
Posts: 3823
Joined: January 31st, 2013, 2:34 am
Location: UK
Contact:

Re: lifeviewer bug

Post by rowett » February 20th, 2024, 3:21 am

rokicki wrote:
February 19th, 2024, 10:14 pm
When there is more than one lifeviewer on a page, the updateMe() doesn't work.
Fixed in build 1111. Thanks for reporting!

User avatar
rowett
Moderator
Posts: 3823
Joined: January 31st, 2013, 2:34 am
Location: UK
Contact:

Re: lifeviewer bug

Post by rowett » February 20th, 2024, 4:43 am

rokicki wrote:
February 19th, 2024, 10:10 pm
It works in the small test case I posted, but unfortunately not when embedded into reveal.js. I'll dig into it more later
and try to come up with a resolution.
I had a quick look at reveal.js and it defines the scaling in a slightly different way than the test case.

Please try build 1113 to see if it works for you.

rokicki
Posts: 80
Joined: August 6th, 2009, 12:26 pm

Re: lifeviewer bug

Post by rokicki » February 20th, 2024, 3:08 pm

Wow, all fixed! Very nice! Chris, this is some amazing customer service.

I'm curious what the difference is in how reveal.js scales the content; some of its code is a bit bewildering.

Ooh, with the fix, I just noticed something; LifeViewer has positive Y going down the screen, where Golly
(at least how I use it), and all my patterns, have positive Y going up the screen. I don't see an option to
"flip" this (at least for coordinate display in the UI); is there such an option? I suppose I could hack one in
to the code . . .

-tom

User avatar
confocaloid
Posts: 3066
Joined: February 8th, 2022, 3:15 pm

Re: lifeviewer bug

Post by confocaloid » February 20th, 2024, 4:00 pm

In build 1113, there seems to be something wrong with detecting coordinates of mouse events. E.g. to run a pattern one needs to click at some point away from the "Play" button; to enter "Help" one needs to click at some point away from the "Help" button. From how it works, it seems to be a factor off from the correct distance from the top left corner.
127:1 B3/S234c User:Confocal/R (isotropic CA, incomplete)
Unlikely events happen.
My silence does not imply agreement, nor indifference. If I disagreed with something in the past, then please do not construe my silence as something that could change that.

rokicki
Posts: 80
Joined: August 6th, 2009, 12:26 pm

Re: lifeviewer bug

Post by rokicki » February 20th, 2024, 4:14 pm

confocaloid wrote:
February 20th, 2024, 4:00 pm
In build 1113, there seems to be something wrong with detecting coordinates of mouse events. E.g. to run a pattern one needs to click at some point away from the "Play" button; to enter "Help" one needs to click at some point away from the "Help" button. From how it works, it seems to be a factor off from the correct distance from the top left corner.
What browser? Do you have a test page that exhibits the problem?

User avatar
confocaloid
Posts: 3066
Joined: February 8th, 2022, 3:15 pm

Re: lifeviewer bug

Post by confocaloid » February 20th, 2024, 4:19 pm

rokicki wrote:
February 20th, 2024, 4:14 pm
confocaloid wrote:
February 20th, 2024, 4:00 pm
In build 1113, there seems to be something wrong with detecting coordinates of mouse events. E.g. to run a pattern one needs to click at some point away from the "Play" button; to enter "Help" one needs to click at some point away from the "Help" button. From how it works, it seems to be a factor off from the correct distance from the top left corner.
What browser? Do you have a test page that exhibits the problem?
Firefox 122. I see the problem both on the forums and on Catagolue (LifeViewer build 1113).
Example page (Catagolue): https://catagolue.hatsya.com/object/xs3 ... 7426/b3s23 After launching the LifeViewer applet, the "Play" and "Help" buttons cannot be clicked by pointing directly at them.

Edit: my system is desktop Ubuntu 22.04.
Here I copied the pattern from the linked Catagolue page. I still see the problem on the forums.

Code: Select all

x = 8, y = 8, rule = B3/S23
2ob2ob2o$bob2ob2o$o$5ob2o$4bob2o$2o2bo$obobob2o$b2ob2obo!
Last edited by confocaloid on February 20th, 2024, 5:24 pm, edited 2 times in total.
127:1 B3/S234c User:Confocal/R (isotropic CA, incomplete)
Unlikely events happen.
My silence does not imply agreement, nor indifference. If I disagreed with something in the past, then please do not construe my silence as something that could change that.

rokicki
Posts: 80
Joined: August 6th, 2009, 12:26 pm

Re: lifeviewer bug

Post by rokicki » February 20th, 2024, 5:15 pm

For me, on MacOS, I tested with Chrome, Safari, and Firefox, all with the link you provided, all the latest versions of the browsers, and had no problems. The play button highlights and operates perfectly from that Catagolue page. I've confirmed it's build 1113 in each case.

Is it possible you are using Windows? Or some mobile device?

User avatar
C28
Posts: 731
Joined: December 8th, 2020, 12:23 pm
Location: WORLD -1

Re: lifeviewer bug

Post by C28 » February 20th, 2024, 6:26 pm

for some reason Lifeviewer is thinking that the cursor is in a different place than it is (down and to the right). it makes placing cells feel weird.
- Christopher D'Agostino

adopted father of the U-turner

Code: Select all

x = 11, y = 15, rule = B3/S23
9bo$8bobo$8bobo$9bo8$b3o$b3o$obo$2o!
the U-turner gallery
255P132
B3/S234z (Zlife)

User avatar
confocaloid
Posts: 3066
Joined: February 8th, 2022, 3:15 pm

Re: lifeviewer bug

Post by confocaloid » February 20th, 2024, 6:33 pm

confocaloid wrote:
February 20th, 2024, 4:19 pm
rokicki wrote:
February 20th, 2024, 4:14 pm
What browser? Do you have a test page that exhibits the problem?
Firefox 122. I see the problem both on the forums and on Catagolue (LifeViewer build 1113).
Example page (Catagolue): https://catagolue.hatsya.com/object/xs3 ... 7426/b3s23 After launching the LifeViewer applet, the "Play" and "Help" buttons cannot be clicked by pointing directly at them.

Edit: my system is desktop Ubuntu 22.04.
Here I copied the pattern from the linked Catagolue page. I still see the problem on the forums.

Code: Select all

x = 8, y = 8, rule = B3/S23
2ob2ob2o$bob2ob2o$o$5ob2o$4bob2o$2o2bo$obobob2o$b2ob2obo!
I just noticed that the issue seems to be dependent both on the browser window size and the zoom level. Expanding the browser window to full screen makes mouse clicks work correctly; however, zooming in the page after that makes the problem appear again.
127:1 B3/S234c User:Confocal/R (isotropic CA, incomplete)
Unlikely events happen.
My silence does not imply agreement, nor indifference. If I disagreed with something in the past, then please do not construe my silence as something that could change that.

User avatar
rowett
Moderator
Posts: 3823
Joined: January 31st, 2013, 2:34 am
Location: UK
Contact:

Re: lifeviewer bug

Post by rowett » February 20th, 2024, 6:49 pm

C28 wrote:
February 20th, 2024, 6:26 pm
for some reason Lifeviewer is thinking that the cursor is in a different place than it is (down and to the right). it makes placing cells feel weird.
Please let me know:
  • Which device you are using (e.g. iPad, Desktop PC, Mobile, etc.)
  • The operating system (e.g. Windows 11, Ubuntu 22.04, etc.)
  • The browser and version (e.g. Chrome 120, Firefox 123, etc.)
  • Which build of LifeViewer you are using (e.g. Build 1113 - this can be obtained by clicking Help).
  • A link to the pattern you were viewing.

User avatar
rowett
Moderator
Posts: 3823
Joined: January 31st, 2013, 2:34 am
Location: UK
Contact:

Re: lifeviewer bug

Post by rowett » February 20th, 2024, 6:53 pm

confocaloid wrote:
February 20th, 2024, 6:33 pm
I just noticed that the issue seems to be dependent both on the browser window size and the zoom level. Expanding the browser window to full screen makes mouse clicks work correctly; however, zooming in the page after that makes the problem appear again.
Are there any messages in the browser console?

rokicki
Posts: 80
Joined: August 6th, 2009, 12:26 pm

Re: lifeviewer bug

Post by rokicki » February 20th, 2024, 7:00 pm

Okay, if I use command-+/command-- to zoom and unzoom in Chrome on MacOS I can replicate the issue.

If I use command-0 to reset the zoom level back to 100% the problem goes away.

User avatar
confocaloid
Posts: 3066
Joined: February 8th, 2022, 3:15 pm

Re: lifeviewer bug

Post by confocaloid » February 20th, 2024, 7:11 pm

rowett wrote:
February 20th, 2024, 6:53 pm
Are there any messages in the browser console?

Code: Select all

0.417188 0.417188 204 lv-plugin.js:186:431
0.5875 0.5875 437 lv-plugin.js:186:431
0.978125 0.978125 50 lv-plugin.js:186:431
Either zooming in or decreasing browser window size decreases the numbers. The first line is for non-full-screen browser window with console taking part of the window; second line is for full-screen browser window with console taking part of the window; third line is for full-screen browser window with console hidden.
127:1 B3/S234c User:Confocal/R (isotropic CA, incomplete)
Unlikely events happen.
My silence does not imply agreement, nor indifference. If I disagreed with something in the past, then please do not construe my silence as something that could change that.

User avatar
C_R_116
Posts: 535
Joined: April 15th, 2021, 2:49 pm
Location: At my home doing other random stuff.

Re: lifeviewer bug

Post by C_R_116 » February 20th, 2024, 9:46 pm

LifeViewer works terrible on my Android phone. (Chrome, Build 1113)

The bottom icons won't work when I tap on them. When I tap the top icons, sometimes the wrong ones are selected. (For example, when I try to tap the draw button, it might select the grid button or change the zoom bar.)

Also, when I try to select something, the selection box is several pixels southeast from my finger. (The offset multiplies when my finger is more southeast from the grid.) This also works for the draw tool.
By: C.R. Hilton, currently working on another cool spaceship.

rokicki
Posts: 80
Joined: August 6th, 2009, 12:26 pm

Re: lifeviewer bug

Post by rokicki » February 20th, 2024, 11:14 pm

Support for scaling may have broken things. Chris, feel free to revert the scaling changes. It may well be that the web is not yet a mature platform.

User avatar
rowett
Moderator
Posts: 3823
Joined: January 31st, 2013, 2:34 am
Location: UK
Contact:

Re: lifeviewer bug

Post by rowett » February 21st, 2024, 12:49 am

Please try build 1114. This should hopefully fix the mouse/touch location issue.

User avatar
rowett
Moderator
Posts: 3823
Joined: January 31st, 2013, 2:34 am
Location: UK
Contact:

Re: lifeviewer bug

Post by rowett » February 21st, 2024, 2:20 am

rokicki wrote:
February 20th, 2024, 3:08 pm
I'm curious what the difference is in how reveal.js scales the content; some of its code is a bit bewildering.
It was using the transform property rather than the scale property.
rokicki wrote:
February 20th, 2024, 3:08 pm
LifeViewer has positive Y going down the screen, where Golly
(at least how I use it), and all my patterns, have positive Y going up the screen. I don't see an option to
"flip" this (at least for coordinate display in the UI); is there such an option? I suppose I could hack one in
to the code . . .
Build 1115 adds the ability to toggle the Y coordinate direction (for display only). Use Settings>Advanced>Y Direction or hotkey F9.
Notes:
  • The default is positive Y going down the screen (as before).
  • The setting will be saved for the current browser on the current device.
  • This only changes how the Y coordinate is displayed. Script commands that take cell locations (for example [[ PASTE ]]) always use positive Y going down the screen.

rokicki
Posts: 80
Joined: August 6th, 2009, 12:26 pm

Re: lifeviewer bug

Post by rokicki » February 22nd, 2024, 11:23 am

Thanks, Chris! Excellent work!

User avatar
H. H. P. M. P. Cole
Posts: 153
Joined: July 15th, 2023, 9:36 pm
Location: Error: 'H. H. P. M. P. Cole' has no attribute 'location'.

Re: lifeviewer bug

Post by H. H. P. M. P. Cole » February 28th, 2024, 3:40 am

Have a try copy-pasting this pattern in lazyslug.com:

Code: Select all

x = 32, y = 32, rule = R3,C2,S2,B3,N+
oooboobooooobooooooboooooboobooo$
obbobooobobobboooobbobobooobobbo$
obboobooobbbbobbbbobbbboooboobbo$
boooobooboobobobboboboobooboooob$
oboooboooobobboooobboboooobooobo$
oobbbobobbbobbboobbbobbbobobbboo$
boooobooboobooboobooboobooboooob$
ooooooobbbobbbbbbbbbbobbbooooooo$
obobobbbobbbbobbbbobbbbobbbobobo$
ooboobobbbboooboobooobbbbobooboo$
obbobboobboobbbbbbbboobboobbobbo$
oobboobbboobobooooboboobbboobboo$
bbbobbobbobobobbbbobobobbobbobbb$
obobbboboobbobboobbobboobobbbobo$
ooboobbbbbbobbobbobbobbbbbbooboo$
oobbooobbobobobbbbobobobbooobboo$
oobbooobbobobobbbbobobobbooobboo$
ooboobbbbbbobbobbobbobbbbbbooboo$
obobbboboobbobboobbobboobobbbobo$
bbbobbobbobobobbbbobobobbobbobbb$
oobboobbboobobooooboboobbboobboo$
obbobboobboobbbbbbbboobboobbobbo$
ooboobobbbboooboobooobbbbobooboo$
obobobbbobbbbobbbbobbbbobbbobobo$
ooooooobbbobbbbbbbbbbobbbooooooo$
boooobooboobooboobooboobooboooob$
oobbbobobbbobbboobbbobbbobobbboo$
oboooboooobobboooobboboooobooobo$
boooobooboobobobboboboobooboooob$
obboobooobbbbobbbbobbbboooboobbo$
obbobooobobobboooobbobobooobobbo$
oooboobooooobooooooboooooboobooo!
If lazyslug.com correctly works it should produce a p8 oscillator in the middle (which it correctly does, on the forums' built-in viewer). However, it doesn't, and instead the soup dies out after 1 generation. Can someone please fix the bug?
Harfordson Parker-Cole

Factorio

User avatar
rowett
Moderator
Posts: 3823
Joined: January 31st, 2013, 2:34 am
Location: UK
Contact:

Re: lifeviewer bug

Post by rowett » February 28th, 2024, 3:57 am

H. H. P. M. P. Cole wrote:
February 28th, 2024, 3:40 am
Have a try copy-pasting this pattern in lazyslug.com:

If lazyslug.com correctly works it should produce a p8 oscillator in the middle (which it correctly does, on the forums' built-in viewer). However, it doesn't, and instead the soup dies out after 1 generation. Can someone please fix the bug?
Fixed, thanks for reporting!

Post Reply