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

[ISSUE 271] Move/Size step min size and default stepping size change. #273

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -39,7 +39,7 @@ Required Tools:
* Grunt: ```npm install -g grunt-cli```
* Protractor: ```npm install -g protractor```
* Jasmine: ```npm install -g jasmine```
* Uglifyjs: ```npm install -g uglifyjs```
* Uglifyjs: ```npm install -g uglify-js```
* Stylus: ```npm install -g stylus```
* Jison: ```npm install -g jison```
* Git-utils: ```npm install git-utils -g ```
Expand Down
6 changes: 3 additions & 3 deletions kb.html
Expand Up @@ -831,7 +831,7 @@
<tr ng-repeat="(k,v) in switchCount()"><td>{{k}}</td><td>{{switchNames[k]}}</td><td>{{v}}</td></tr>
</table>
</div>
</div>
</div>
<div class="btn-group btn-group-xs" role="group">
<br><button type="button" class="btn btn-success" ng-click="printDiv('printSummary')"><i class="fa fa-print"></i> Print summary</button>
</div>
Expand Down Expand Up @@ -1032,7 +1032,7 @@ <h5>Editor Step Sizes:</h5>
<div class="form-group form-group-sm">
<div class="input-group input-group-sm hint--top hint--rounded"
data-hint="Controls the step size when moving keys around the keyboard layout.">
<input id="moveStepEditor" class="form-control" type="number" min="0.05" max="2.5" step="0.05" size="6" ng-model="params.moveStep">
<input id="moveStepEditor" class="form-control" type="number" min="0.0005" max="2.5" step="0.0125" size="9" ng-model="params.moveStep">
<span class="input-group-addon">units</span>
</div>
</div>
Expand All @@ -1047,7 +1047,7 @@ <h5>Editor Step Sizes:</h5>
<div class="form-group form-group-sm">
<div class="input-group input-group-sm hint--top hint--rounded"
data-hint="Controls the step size when resizing keys in the keyboard layout.">
<input id="sizeStepEditor" class="form-control" type="number" min="0.05" max="2.5" step="0.05" size="6" ng-model="params.sizeStep">
<input id="sizeStepEditor" class="form-control" type="number" min="0.0005" max="2.5" step="0.0125" size="9" ng-model="params.sizeStep">
<span class="input-group-addon">units</span>
</div>
</div>
Expand Down
16 changes: 8 additions & 8 deletions kb.js
Expand Up @@ -73,8 +73,8 @@
$scope.meta = {};

// Options
$scope.sizeStep = 0.25;
$scope.moveStep = 0.25;
$scope.sizeStep = 0.0125;
$scope.moveStep = 0.0125;
$scope.rotateStep = 15;

// The keyboard data
Expand Down Expand Up @@ -1080,8 +1080,8 @@

transaction("move", function() {
$scope.selectedKeys.forEach(function(selectedKey) {
selectedKey.x = Math.round10(Math.max(0,selectedKey.x + x),-2);
selectedKey.y = Math.round10(Math.max(0,selectedKey.y + y),-2);
selectedKey.x = Math.round10(Math.max(0,selectedKey.x + x),-4);
selectedKey.y = Math.round10(Math.max(0,selectedKey.y + y),-4);
renderKey(selectedKey);
});
$scope.multi = angular.copy($scope.selectedKeys.last());
Expand All @@ -1097,8 +1097,8 @@
}
transaction("size", function() {
$scope.selectedKeys.forEach(function(selectedKey) {
update(selectedKey, 'width', validate(selectedKey, 'width', Math.round10(Math.max(1,selectedKey.width + x),-2)));
update(selectedKey, 'height', validate(selectedKey, 'height', Math.round10(Math.max(1,selectedKey.height + y),-2)));
update(selectedKey, 'width', validate(selectedKey, 'width', Math.round10(Math.max(1,selectedKey.width + x),-4)));
update(selectedKey, 'height', validate(selectedKey, 'height', Math.round10(Math.max(1,selectedKey.height + y),-4)));
renderKey(selectedKey);
});
$scope.multi = angular.copy($scope.selectedKeys.last());
Expand Down Expand Up @@ -1131,8 +1131,8 @@
}
transaction("moveCenter", function() {
$scope.selectedKeys.forEach(function(selectedKey) {
update(selectedKey, 'rotation_x', validate(selectedKey, 'rotation_x', Math.round10($scope.multi.rotation_x + x,-2)));
update(selectedKey, 'rotation_y', validate(selectedKey, 'rotation_y', Math.round10($scope.multi.rotation_y + y,-2)));
update(selectedKey, 'rotation_x', validate(selectedKey, 'rotation_x', Math.round10($scope.multi.rotation_x + x,-4)));
update(selectedKey, 'rotation_y', validate(selectedKey, 'rotation_y', Math.round10($scope.multi.rotation_y + y,-4)));
renderKey(selectedKey);
});
$scope.multi = angular.copy($scope.selectedKeys.last());
Expand Down
6 changes: 3 additions & 3 deletions serial.js
Expand Up @@ -219,8 +219,8 @@ var $serial = (typeof(exports) !== 'undefined') ? exports : {};
current.rotation_angle = serializeProp(props, "r", key.rotation_angle, current.rotation_angle);
current.rotation_x = serializeProp(props, "rx", key.rotation_x, current.rotation_x);
current.rotation_y = serializeProp(props, "ry", key.rotation_y, current.rotation_y);
current.y += serializeProp(props, "y", key.y-current.y, 0);
current.x += serializeProp(props, "x", key.x-current.x, 0) + key.width;
current.y += serializeProp(props, "y", Math.round10(key.y-current.y, -4), 0);
current.x += Math.round10(serializeProp(props, "x", Math.round10(key.x-current.x, -4), 0) + key.width, -4);
current.color = serializeProp(props, "c", key.color, current.color);
if(!ordered.textColor[0]) {
ordered.textColor[0] = key.default.textColor;
Expand Down Expand Up @@ -338,7 +338,7 @@ var $serial = (typeof(exports) !== 'undefined') ? exports : {};
if(key.fa) { current.textSize = key.fa; }
if(key.p) { current.profile = key.p; }
if(key.c) { current.color = key.c; }
if(key.t) {
if(key.t) {
var split = key.t.split('\n');
current.default.textColor = split[0];
current.textColor = reorderLabelsIn(split, align);
Expand Down