Friday, September 28, 2018

Linking MKI3D stages into webs of stages

URL links in the  MKI3D editor 

In the recent version of MKI3D you can place URL links in your designed stages that can be followed when the stage is browsed in  MKI3D TRAVEL.
The link symbol in the MKI3D editor looks like that:


Like the selected and bookmarked points, the link symbols are displayed in the current cursor's  color, and are always facing the observer.

URL submenu

There is a new position 'U' on the main menu:



This is for creating and manipulating URL links. At present, the URL submenu looks like that:


You can add a new empty link at the cursor position by pressing the 'A' key on this submenu.
(There is a minimal distance required between any two links positions.)

The edit ('E'), cut ('X') and paste ('V'actions are performed on the link at cursor position. 
There is a new option 'U' at the cursor submenu, the moves the cursor to the position of the nearest link.



Edit URL submenu

The editing of link is done in the following submenu:


The textfields on Edit URL  submenu

There are three input text fields for: LABEL, OPENER, and URL.

LABEL may be any any text. It is prominently displayed in the  MKI3D TRAVEL, when the user is offered to follow the link.

OPENER and URL are used to construct the actual URL of the page that is opened by the link.
If OPENER and URL are full (i.e. not relative) URLs, then they are simply concatenated.
The result should be a legal full URL that can be opened by the browser.

For example if:

  • OPENER is 'https://mki1967.github.io/mki3d/mki3d_www/mki3d.html?input=', and
  • URL is 'https://mki1967.github.io/mki3d-data/data/web/stage1.mki3d',
then the actual URL to be opened is:


https://mki1967.github.io/mki3d/mki3d_www/mki3d.html?input=https://mki1967.github.io/mki3d-data/data/web/stage1.mki3d

If OPENER or URL is a relative URL, then it is first extended to a full URL
("actual opener URL" or "actual input URL", respectively).
Then the concatenation of "actual opener URL" with "actual input URL"  is the URL to be opened by the browser.

The construction is made with the URL() constructor ,
where a different "base URLs" are used for OPENER and URL
( "opener URL base" and  "input URL base", respectively).

Computing "actual input URL" from URL

The "actual input URL" is made from the URL with the "input URL base",
if the URL is a relative URL. 

If the the MKI3D editor or  in the  MKI3D TRAVEL were opened with the parameter '?input=' ,
then the "input URL base" is  the URL of the loaded stage.
(The value of the parameter  '?input=' may also be an relative URL. In such case, the "input URL base" is the URL of the document.referrer - the URL of the page from which it is opened.)

Thus the relative URL links in the stage are assumed to have the same base as the stage itself. (This enables desingnig and testing  of local webs with the http://localhost server and then publishing them e.g. by pushing on public static pages such as GitHub Pages.)

Computing "actual opener URL" from OPENER

If the OPENER is empty the the "actual opener URL" is also empty.

In  MKI3D TRAVEL and in MKI3D editor  the "opener URL base" is taken from
window.location.href, thus the OPENER from the link is assumed to have the same base as the current opener of the stage.

Note that


have the same url base. 
Thus, if you are working in the editor open from the URL: 

 https://mki1967.github.io/mki3d/mki3d_www/mki3d.html 

and if the link has:

  • OPENER : 'travel.html?input=', and
  • URL : 'https://mki1967.github.io/mki3d-data/data/web/stage1.mki3d',
then the actual URL to be opened is:

https://mki1967.github.io/mki3d/mki3d_www/travel.html?input=https://mki1967.github.io/mki3d-data/data/web/stage1.mki3d

On the other hand, if the editor were open from URL:

http://localhost:8000/mki3d/mki3d_www/mki3d.html

then the actual URL to be opened by such link would be:

http://localhost:8000/mki3d/mki3d_www/travel.html?input=https://mki1967.github.io/mki3d-data/data/web/stage1.mki3d

This is useful if you want to work with applications served by the http://localhost server
from your local clones of MKI3D repo
(You may follow the hints from README.md  of the mki3d-data repo.)
Probably, you would like to have the links with the short relative URLs, like:
  • OPENER: 'travel.html?input=', and
  • URL: 'stage1.mki3d'

Remainig options of URL Edit submenu

The 'Tab' key on the submenu lets you test what would be opened with the  current values
of OPENER and URL.
Note that the the actual URL opened by the link with relative URLs depends on how the editor was started.

The 'X' and 'V' keys let you cut the link and then paste it in the cursor positions. This is useful if you want to remove the link, or to make many copies or similar links.


Stages in the  MKI3D editor vs. the stages in the MKI3D TRAVEL.

Stages browsed in MKI3D TRAVEL the  are designed in the  MKI3D editor .

The entry point to the stage in the MKI3D TRAVEL is where the cursor was left in the  MKI3D editor . 

The observer is aligned with X,Y,Z axes looking into positive Z direction. 
To see the orientation in  MKI3D editor , you should see the cursor like that:



The scaling from MKI3D editor is not applied in  MKI3D TRAVEL. To see the size of the stage in MKI3D editor set CURSOR STEP to 1 on the Inputs Page ('QI').

Don't forget to set the proper light direction ('QDL') . It is used in the  MKI3D TRAVEL.

INDEX OF MKI3D WEB

I have just created a HTML page on GitHb Pages that is intended to contain a list of links that are entries to the web of MKI3D stages. The address of the page is:  https://mki3d.github.io/mki3d-web-index/

If you want to submit  such link to your stage the please read and follow the simple instructions in
README.md. (I short: you just have to open new issue containing the URL that opens your stage in MKI3D TRAVEL.)

No comments:

Post a Comment