Cédric Canguilhem

PI Vision Easter Eggs - Step 5 : Add the easter egg trick

Blog Post created by Cédric Canguilhem on Oct 21, 2020

Hi all, PI Vision developers !

 

This blog post is part of a mini-series about adding a log feature to the native Value symbol, and hiding it into an easter egg. I suggest reading the previous blog posts if not done yet :

 

In the first steps of this mini-series of blog post, we created 2 custom option groups inside the configuration pane of the native "Value" symbol, and a button to manage their visibility :

 

 

Step 5 : How to hide some configuration options behind an easter egg

For the easter egg, I choose those very uncommon settings :

 

  • Fill color is set to "#abcdef"
  • Text color is set to "#cdefab"
  • Value color is set to "#efabcd"
  • Font size is set to "1.2"

 

Add the following lines in the "configChange" function, just after the lines implementing the log added during the previous blog post :

// Easter Egg trick
if (newConfig.Fill == "#abcdef"
&& newConfig.Stroke == "#cdefab"
&& newConfig.ValueStroke == "#efabcd"
&& newConfig.FontSize == 1.2) {

// Show the secret configuration option groups
newConfig.ShowEasterEggOptions = true;
}

 

Check the result :

 

Few imperfections that have to be fixed :

  1. The "Change Status" button must be part of the easter egg (not shown by default), and its text has to be more significant.
  2. The user has to change at least one value of the configuration items linked to the easter egg, otherwise the "Change Status" button has no effect.
  3. The font size of 1.2 make the symbol not readable at all. This value is obviously not the one to be kept in long term.

 

2 solutions for point 1. :

  1. Just move the button inside the "About" option group in the "sym-value-config.html" file, and rename it as below :
  2. Or add the "ng-show" directive to the button (preferred one) :

 

Points 2. and 3. will be solved with the following lines in the "configChange" function :

 

Check the result :

 

If you have any question or suggestion about this mini-series, don't hesitate !

 

 

Outcomes