diff --git a/demo/alexfung.html b/demo/alexfung.html new file mode 100644 index 0000000..5dd0a00 --- /dev/null +++ b/demo/alexfung.html @@ -0,0 +1,45 @@ + + + + + +

alexfung commits demo

+

+ This demo page shows the effects of the commits on the alexfung branch, + which is a fork of the 1.4 master. +

+ The demo files refer to the roofpig JS file at the root of this repo. + That file is not exactly the same as the output of the build process. + The roofpig JS file contains non-ANSI characters and may confuse browsers. + I have added BOM to the roofpig JS file at the root of this repo to make sure browsers know it is a UTF-8 file. +

+ +

Color Fix

+

+ In 1.4 (and 1.5P) color is not assigned correctly if alg= includes any M/E/S slice movement or x/y/z rotation. + Fixed in the color fix commit. +

+
Normal: U on top
+
color fix for M
+
color fix for X
+ +

Upper Case XYZ

+

+ Using the algdisplay=xyzUpper option, X/Y/Z are displayed in upper case, as they should be. +

+
Lower Case xyz
+
Upper Case XYZ
diff --git a/demo/alg.html b/demo/alg.html new file mode 100644 index 0000000..ec0ffe5 --- /dev/null +++ b/demo/alg.html @@ -0,0 +1,14 @@ + + + + + +

Roofpig 'alg' demo

+
Basic moves
+ +
Standard advanced moves
+ +
Roofpig advanced moves
diff --git a/demo/cubexp.html b/demo/cubexp.html new file mode 100644 index 0000000..cc1f4e2 --- /dev/null +++ b/demo/cubexp.html @@ -0,0 +1,30 @@ + + + + + +

Roofpig Cubexp Lab

+ +
UFR DFR LF R
+
UfR DFr lF R
+
F*
+
FR*
+
U-
+
BD-
+
BLD-
+
FB-
+
r
+
*/mc
+
r/e
diff --git a/demo/other.html b/demo/other.html new file mode 100644 index 0000000..da47dab --- /dev/null +++ b/demo/other.html @@ -0,0 +1,29 @@ + + + + + +

Roofpig various options Demo

+ +
colors in pink
+
non sticker colors
+
startsolved
+ +
algdisplay=fancy2s
+
algdisplay=rotations 2p
+ +
hover=far
+
hover=5
+
hover=near
+
hover=none
diff --git a/demo/readme.html b/demo/readme.html new file mode 100644 index 0000000..8078d87 --- /dev/null +++ b/demo/readme.html @@ -0,0 +1,34 @@ + + + + +

Offline demo

+

+ The original roofpig demos are at jsfiddle.net + They are no longer operational, because they tried to load the roofpig_and_three.js over http. + Therefore, I downloaded the demo file so I can run them offline. +

+ The demo files refer to the roofpig JS file at the root of this repo. + The script has non-ANSI characters, and most browsers will not like it. + To browse the demo locally, you may need to manually add BOM at the start of the file. + A bom.txt is included under /lib for you. +

+

+ Also, I added an extra demo file for the changes I made to the repo. +

+

Demo pages

+ + diff --git a/demo/sample.html b/demo/sample.html new file mode 100644 index 0000000..c8fe235 --- /dev/null +++ b/demo/sample.html @@ -0,0 +1,22 @@ + + + + + +

Roofpig Feature Sample

+ +
Simple.             Helpful ->
+ +
Customizable. Edgy.
+ +
Big. Visible. Fast.
diff --git a/demo/solved.html b/demo/solved.html new file mode 100644 index 0000000..be34f0b --- /dev/null +++ b/demo/solved.html @@ -0,0 +1,27 @@ + + + + + +

Roofpig solved and colored Lab

+ +
Cross
+
F2L
+
PLL
+
OLL
+
Petrus Step 1
+
Petrus Step 2
+
Petrus Step 3
+
Petrus Step 4
diff --git a/demo/tweaks.html b/demo/tweaks.html new file mode 100644 index 0000000..cec4147 --- /dev/null +++ b/demo/tweaks.html @@ -0,0 +1,22 @@ + + + + + +

Roofpig 'setupmoves' and 'tweaks' Lab

+ +
setupmoves
+
color tweaks
+
X tweaks
+
All at once
diff --git a/lib/bom.txt b/lib/bom.txt new file mode 100644 index 0000000..5f28270 --- /dev/null +++ b/lib/bom.txt @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/Alg.coffee b/src/Alg.coffee index f0b94d7..294107e 100644 --- a/src/Alg.coffee +++ b/src/Alg.coffee @@ -71,13 +71,14 @@ class Alg if code.indexOf('+') > -1 new CompositeMove(code, @world3d, @speed) - else if code[0] in ['x', 'y', 'z'] + else if (c0lower = code[0].toLowerCase()) in ['x', 'y', 'z'] [t1, t2] = turn_codes[Move.parse_turns(code.substring(1))] - moves = switch code[0] + moves = switch c0lower when 'x' then "R#{t1}+M#{t2}+L#{t2}" when 'y' then "U#{t1}+E#{t2}+D#{t2}" when 'z' then "F#{t1}+S#{t1}+B#{t2}" - new CompositeMove(moves, @world3d, @speed, code) + new CompositeMove(moves, @world3d, @speed, c0lower + code.substring(1)) + # allow input XYZ, but must store as xyz or else Z will be displayed as 2 else last_char_index = 2 if (code[1] == 'w' && code[0] in ['U', 'D', 'L', 'R', 'F', 'B']) diff --git a/src/Config.coffee b/src/Config.coffee index f51bfcd..1ac998d 100644 --- a/src/Config.coffee +++ b/src/Config.coffee @@ -45,6 +45,7 @@ class Config ad = this.raw(ALGDISPLAY) result = {} result.fancy2s = ad.indexOf('fancy2s') > -1 + result.xyzUpper = ad.indexOf('xyzUpper') > -1 result.rotations = ad.indexOf('rotations') > -1 result.Zcode = "2" result.Zcode = "2'" if ad.indexOf('2p') > -1 diff --git a/src/Dom.coffee b/src/Dom.coffee index 9c78f46..996c942 100644 --- a/src/Dom.coffee +++ b/src/Dom.coffee @@ -90,7 +90,15 @@ class Dom @buttons = [@reset, @prev, @next, @pause, @play] - LUCIDA_WIDTHS = {M:108, '+':100, '>':100, '<':100, w:98, D:94, U:87, 2:80, R:80, x:78, Z:77, B:73, z:73, F:68, E:68, S:68, L:67, y:65, '²':53, ' ':40, "'":29} + # LUCIDA_WIDTHS = {M:108, '+':100, '>':100, '<':100, w:98, D:94, U:87, 2:80, R:80, x:78, Z:77, B:73, z:73, F:68, E:68, S:68, L:67, y:65, '²':53, ' ':40, "'":29} + LUCIDA_WIDTHS = {M:108, '+':100, '>':100, '<':100, w:98, D:94, U:87, 2:80, R:80, x:78, Z:77, B:73, z:73, F:68, E:68, S:68, L:67, y:65, '²':53, ' ':40, "'":29 + , X:79, Y:79 + } + # I haven't really found out what the width here means. + # Below are the real values from the Lucida Sans font, + # since +/ are 1628, I divide numbers by 16.28 and round up to get the value for LUCIDA_WIDTHS + # , X:1282, Y:1276 + init_alg_text: (text) -> if @alg_text width = 0 diff --git a/src/Move.coffee b/src/Move.coffee index f336050..a201573 100644 --- a/src/Move.coffee +++ b/src/Move.coffee @@ -77,6 +77,7 @@ class Move @displayify: (move_text, algdisplay) -> result = move_text.replace('Z', algdisplay.Zcode) result = result.replace('2', '²') if algdisplay.fancy2s + result = result.replace("x", 'X').replace("y", 'Y').replace("z", 'Z') if algdisplay.xyzUpper result display_text: (algdisplay) ->