Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(developer): Rework Touch Layout Editor to support flick and multitap 🙊 #6884

Merged
merged 23 commits into from
Jul 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
c88826c
chore(developer): refactor builder.js
mcdurdin Jul 1, 2022
f8f2715
chore(developer): refactor undo actions out of builder.js
mcdurdin Jul 1, 2022
83bf20c
chore(developer): refactor 'constants' out of builder.js
mcdurdin Jul 1, 2022
054423f
chore(developer): refactor subkeys out of builder.js
mcdurdin Jul 1, 2022
5875cf5
chore(developer): update jquery-ui version to 1.13.1
mcdurdin Jul 4, 2022
a637b58
feat(developer): rework touch layout editor
mcdurdin Jul 3, 2022
feee081
feat(developer): tweaks ui for selected key cap
mcdurdin Jul 4, 2022
268ba98
feat(developer): Support new touch layout definitions in Delphi
mcdurdin Jul 4, 2022
f9241f4
chore(developer): minor cleanup
mcdurdin Jul 4, 2022
d294684
chore(developer): remove multitap icon cleanly
mcdurdin Jul 4, 2022
b702b7d
fix(developer): fix issues with template and presentation
mcdurdin Jul 12, 2022
60dabb5
feat(developer): add support for flick and multitap to compiler
mcdurdin Jul 12, 2022
51a94a1
feat(developer): cleanup touch layout files on load and save
mcdurdin Jul 9, 2022
11d8a3a
feat(developer): add hint properties to touch layout schema
mcdurdin Jul 12, 2022
54a655e
feat(developer): add hint and displayHint to touch layout validation …
mcdurdin Jul 12, 2022
a362f27
feat(developer): add hint property to touch layout editor
mcdurdin Jul 12, 2022
1738f12
feat(developer): add displayHint property to touch layout editor
mcdurdin Jul 13, 2022
02d0358
chore(developer): simplify dialog workflow
mcdurdin Jul 13, 2022
6032181
feat(developer): rework displayHint to defaultHint
mcdurdin Jul 13, 2022
c8971a4
chore: Apply suggestions from code review
mcdurdin Jul 14, 2022
ca47fce
Merge pull request #6917 from keymanapp/feat/developer/touch-layout-s…
mcdurdin Jul 25, 2022
dfb9776
Merge pull request #6925 from keymanapp/feat/developer/touch-layout-c…
mcdurdin Jul 25, 2022
b438a20
Merge pull request #6936 from keymanapp/feat/developer/5079-touch-lay…
mcdurdin Jul 25, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 50 additions & 12 deletions common/schemas/keyman-touch-layout/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ The general structure of a .keyman-touch-layout file is:
## `root` object

The `root` object may contain up to three properties, each being a [`platform`
object](#platform-object), named `"phone"`, `"tablet"` or `"desktop"`.
object](#platform-object), named `"phone"`, `"tablet"` or `"desktop"`. There
must be at least one property.

## `platform` object

Expand All @@ -68,7 +69,7 @@ optionally contain three additional properties: `font`, `fontsize`, and
`displayUnderlying`.

* `layer`
: An array of [`layer` objects](#layer-object). Required.
: A non-empty array of [`layer` objects](#layer-object). Required.

* `font`
: An optional CSS-style font-family specification, being the name of the font to
Expand All @@ -83,6 +84,29 @@ optionally contain three additional properties: `font`, `fontsize`, and
: A boolean value, if `true`, then the base layout's key cap will be displayed
in the top left of the key cap. Defaults to `false`.

* `defaultHint`

: A string value. Default is `"dot"`. Controls the display of the hint text on
the key cap, which is shown at the top right of the key cap.

* `"none"`: show no hint on the key cap.
* `"dot"`: show a dot on top-right of key cap if a longpress menu is
available, default. Matches behavior for Keyman 15.0 and earlier.
* `"longpress"`: show the default longpress key cap, if it exists.
* `"multitap"`: show the first multitap key cap, if it exists.
* `"flick"`: show the first flick key cap, selected in clockwise order,
starting from North.
* `"flick-n"`: show the key cap from the North flick, if it exists.
* `"flick-ne"`: show the key cap from the North-East flick, if it exists.
* `"flick-e"`: show the key cap from the East flick, if it exists.
* `"flick-se"`: show the key cap from the South-East flick, if it exists.
* `"flick-s"`: show the key cap from the South flick, if it exists.
* `"flick-sw"`: show the key cap from the South-West flick, if it exists.
* `"flick-w"`: show the key cap from the West flick, if it exists.
* `"flick-nw"`: show the key cap from the North-West flick, if it exists.

Introduced in Keyman 16.0.

## `layer` object

The `layer` object describes one visible layer on a touch keyboard. It has two
Expand Down Expand Up @@ -140,7 +164,7 @@ affect the modifiers in any key events generated by keys on the layer.

* `row`

: An array of [`row` objects](#row-object). Required.
: A non-empty array of [`row` objects](#row-object). Required.

## `row` object

Expand All @@ -150,19 +174,19 @@ properties: `id` and `key`.
* `id`

: An non-negative integer denoting where the row appears, with `0` being the top
row.
row. Required.

Legacy: this value was sometimes an integer in a string. This string format is
deprecated and will not be supported in future versions of Keyman Developer.

* `key`

: An array of [`key` objects](#key-object).
: A non-empty array of [`key` objects](#key-object). Required.

## `key` object

Describes a single key on a touch layout row. See also [`sk`
object](#sk-object). A `key` object has no required properties.
object](#sk-object). A `key` object must include either an `id` or `sp` property.

* `id`

Expand Down Expand Up @@ -201,6 +225,13 @@ object](#sk-object). A `key` object has no required properties.

: String. The string displayed on the key cap.

* `hint`

: String. If present, a small hint, often shown at top right of key cap.

Introduced in Keyman 16.0.


* `layer`

: String. If specified, overrides the modifier associated with the layer (this
Expand Down Expand Up @@ -291,19 +322,24 @@ object](#sk-object). A `key` object has no required properties.

: If present, defines additional keys that may be selected when using a
flick gesture on the key, with a [`flick` object](#flick-object). Flicks
should not be used on modifier keys, special keys, or the Spacebar. Keyman 16+.
should not be used on modifier keys, special keys, or the Spacebar.

Introduced in Keyman 16.0.

* `multitap`

: If present, defines an array of keys that may be selected sequentially when
tapping multiple times on the key, an array of [`sk` objects](#sk-object).
Multitaps generally should not be used on modifier keys, special keys, or the
Multitaps may not be used on layer switch keys, special keys such as the globe key, or the
Spacebar. Beware of mixing multitaps with layer switching, as this can lead to
a confusing user experience. Keyman 16+.
a confusing user experience.

Keyman 15+: the Shift key has a predefined multitap sequence to access the
`caps` layer, which is available if the `caps` layer is present. This is the
only multitap sequence supported in Keyman 15.
only multitap sequence supported in Keyman 15. This multitap sequence cannot
be overridden, and is the sole case where multitap input may cause a layer switch.

Introduced in Keyman 16.0.

## `sk` object

Expand All @@ -314,7 +350,9 @@ properties are not fully supported as of Keyman 15: `font`, `fontsize`, `pad`,
and `width`.

* `id`
: A string identifier for the longpress key. See `key` object for details.

: String. Required. An identifier for the longpress key. See `key` object for
details.

* `text`

Expand Down Expand Up @@ -408,7 +446,7 @@ string") into the appropriate spec format.
# .keyman-touch-layout version history

## 2022-06-30 2.0 stable
* Add support for flick and multitap. Aligns with Keyman 16.0.
* Add support for flick, multitap, hint, defaultHint. Aligns with Keyman 16.0.

## 2022-06-27 1.0 stable
* Initial schema version and full documentation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
"tablet": { "$ref": "#/definitions/platform" },
"phone": { "$ref": "#/definitions/platform" },
"desktop": { "$ref": "#/definitions/platform" }
}
},
"minProperties": 1,
"additionalProperties": false
},

"platform": {
Expand All @@ -20,15 +22,17 @@
"font": { "$ref": "#/definitions/font-spec" },
"fontsize": { "$ref": "#/definitions/fontsize-spec" },
"layer": { "$ref": "#/definitions/layers" },
"displayUnderlying": { "type": "boolean" }
"displayUnderlying": { "type": "boolean" },
"defaultHint": { "type": "string", "enum": ["none","dot","longpress","multitap","flick","flick-n","flick-ne","flick-e","flick-se","flick-s","flick-sw","flick-w","flick-nw"] }
},
"required": ["layer"],
"additionalProperties": false
},

"layers": {
"type": "array",
"items": { "$ref": "#/definitions/layer" }
"items": { "$ref": "#/definitions/layer" },
"minItems": 1
},

"layer": {
Expand All @@ -48,7 +52,8 @@

"rows": {
"type": "array",
"items": { "$ref": "#/definitions/row" }
"items": { "$ref": "#/definitions/row" },
"minItems": 1
},

"row": {
Expand All @@ -69,7 +74,8 @@

"keys": {
"type": "array",
"items": { "$ref": "#/definitions/key" }
"items": { "$ref": "#/definitions/key" },
"minItems": 1
},

"key": {
Expand All @@ -86,8 +92,16 @@
"width": { "$ref" : "#/definitions/key-width" },
"sk": { "$ref": "#/definitions/subkeys" },
"flick": { "$ref": "#/definitions/flick" },
"multitap": { "$ref": "#/definitions/subkeys" }
"multitap": { "$ref": "#/definitions/subkeys" },
"hint": { "type": "string" }
},
"anyOf": [
{"required": ["id"]},
{"required": ["sp"]},
{"required": ["sk"]},
{"required": ["flick"]},
{"required": ["multitap"]}
],
"additionalProperties": false
},

Expand All @@ -98,24 +112,25 @@

"key-sp": {
"type": "integer",
"enum": [0, 1, 2, 8, 9, 10],
"enum": [0, 1, 2, 8, 9, 10]
},

"key-pad": {
"type": "number",
"minimum": 0,
"maximum": 10000
"maximum": 100000
},

"key-width": {
"type": "number",
"minimum": 0,
"maximum": 1000
"maximum": 100000
},

"subkeys": {
"type": "array",
"items": { "$ref": "#/definitions/subkey" }
"items": { "$ref": "#/definitions/subkey" },
"minItems": 1
},

"subkey": {
Expand All @@ -140,6 +155,7 @@
"patternProperties": {
"^(n|s|e|w|ne|nw|se|sw)$": { "$ref": "#/definitions/subkey" }
},
"minProperties": 1,
"additionalProperties": false
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
"font": { "$ref": "#/definitions/font-spec" },
"fontsize": { "$ref": "#/definitions/fontsize-spec" },
"layer": { "$ref": "#/definitions/layers" },
"displayUnderlying": { "type": "boolean" }
"displayUnderlying": { "type": "boolean" },
"defaultHint": { "type": "string", "enum": ["none","dot","longpress","multitap","flick","flick-n","flick-ne","flick-e","flick-se","flick-s","flick-sw","flick-w","flick-nw"] }
},
"required": ["layer"],
"additionalProperties": false
Expand Down Expand Up @@ -95,7 +96,8 @@
"width": { "$ref" : "#/definitions/numeric" },
"sk": { "$ref": "#/definitions/subkeys" },
"flick": { "$ref": "#/definitions/flick" },
"multitap": { "$ref": "#/definitions/subkeys" }
"multitap": { "$ref": "#/definitions/subkeys" },
"hint": { "type": "string" }
},
"additionalProperties": false
},
Expand Down
1 change: 1 addition & 0 deletions developer/src/tike/child/UfrmKeymanWizard.pas
Original file line number Diff line number Diff line change
Expand Up @@ -3323,6 +3323,7 @@ procedure TfrmKeymanWizard.SelectTouchLayoutTemplate(APromptChange: Boolean);
PromptChange := APromptChange;
if ShowModal = mrOk then
begin
frameTouchLayout.SaveToString;
frameTouchLayout.TemplateFileName := TemplateFileName;
frameTouchLayout.Load('', True, False); // I4034
Self.Modified := True;
Expand Down
6 changes: 6 additions & 0 deletions developer/src/tike/compile/CompileKeymanWeb.pas
Original file line number Diff line number Diff line change
Expand Up @@ -1672,6 +1672,7 @@ function TCompileKeymanWeb.ValidateLayoutFile(var sLayoutFile: string; const sVK
FSubKey: TTouchLayoutSubKey;
FRequiredKeys: set of TRequiredKey;
FDictionary: TStringList;
FDirection: TTouchLayoutFlickDirection;

function IsValidUnicodeValue(ch: Integer): Boolean; // I4198
begin
Expand Down Expand Up @@ -1873,6 +1874,11 @@ function TCompileKeymanWeb.ValidateLayoutFile(var sLayoutFile: string; const sVK
CheckKey(FKey.Id, FKey.Text, FKey.NextLayer, FKey.SpT); // I4119
for FSubKey in FKey.Sk do
CheckKey(FSubKey.Id, FKey.Text, FSubKey.NextLayer, FSubKey.SpT); // I4119
for FDirection in FKey.Flick.Keys do
CheckKey(FKey.Flick[FDirection].Id, FKey.Flick[FDirection].Text,
FKey.Flick[FDirection].NextLayer, FKey.Flick[FDirection].SpT);
for FSubKey in FKey.MultiTap do
CheckKey(FSubKey.Id, FKey.Text, FSubKey.NextLayer, FSubKey.SpT);
end;

if FRequiredKeys <> CRequiredKeys then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ procedure TAppSourceHttpResponder.RespondTouchEditorLib(
begin
doc := ARequestInfo.Document;
Delete(doc, 1, Length('/app/source/toucheditor/lib/'));
if (Pos('/', doc) > 0) or (Pos('\', doc) > 0) then
if Pos('..', doc) > 0 then
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do allow sub-paths, just not parent navigation -- this fixes loading of jquery-ui images.

Respond404(AContext, ARequestInfo, AResponseInfo)
else
RespondFile(GetLayoutBuilderPath + doc, AContext, ARequestInfo, AResponseInfo);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class function TKeymanDeveloperPaths.NodePath: string;
KeymanRoot: string;
begin
if TKeymanPaths.RunningFromSource(KeymanRoot)
then Result := KeymanRoot + 'developer\src\inst\dist\node.exe'
then Result := KeymanRoot + 'developer\src\inst\node\dist\node.exe'
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixup for node loading when running Developer from within a debugger in the source path.

else Result := ExtractFilePath(ParamStr(0)) + 'node.js\node.exe';
end;

Expand Down
Loading