Skip to content

Commit

Permalink
Fix box sizing bug (#36)
Browse files Browse the repository at this point in the history
* Fix border-box bug

* Build and bump
  • Loading branch information
stuartmemo authored Sep 21, 2020
1 parent b2699b7 commit 2cf4ce3
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 10 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "qwerty-hancock",
"main": "dist/qwerty-hancock.js",
"version": "0.6.0",
"version": "0.6.1",
"homepage": "http://stuartmemo.com/qwerty-hancock/",
"authors": [
{
Expand Down
45 changes: 41 additions & 4 deletions dist/qwerty-hancock.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Qwerty Hancock keyboard library v0.6.0
* Qwerty Hancock keyboard library v0.6.1
* The web keyboard for now people.
* Copyright 2012-18, Stuart Memo
*
Expand All @@ -15,7 +15,7 @@
* In node context (browserify), `this` is the node global.
*/
var globalWindow = typeof global === 'undefined' ? root : root.window;
var version = '0.6.0',
var version = '0.6.1',
settings = {},
mouse_is_down = false,
keysDown = {},
Expand Down Expand Up @@ -87,6 +87,31 @@
}

settings.startOctave = parseInt(settings.startNote.charAt(1), 10);
settings.keyOctave = user_settings.keyOctave || settings.startOctave;

// Add getters and setters
this.setKeyOctave = function(octave){
settings.keyOctave = octave;
return settings.keyOctave;
}
this.getKeyOctave = function(){
return settings.keyOctave;
}
this.keyOctaveUp = function(){
settings.keyOctave++;
return settings.keyOctave;
}
this.keyOctaveDown = function(){
settings.keyOctave--;
return settings.keyOctave;
}
this.getKeyMap = function(){
return key_map;
}
this.setKeyMap = function(newKeyMap){
key_map = newKeyMap;
return key_map;
}

createKeyboard();
addListeners.call(this, container);
Expand Down Expand Up @@ -236,6 +261,7 @@
el.style.margin = 0;
el.style.width = settings.width + 'px';
el.style['-webkit-user-select'] = 'none';
el.style.boxSizing = 'content-box';
};

styleElement(keyboard.container);
Expand Down Expand Up @@ -388,8 +414,8 @@

var getKeyPressed = function (keyCode) {
return key_map[keyCode]
.replace('l', parseInt(settings.startOctave, 10) + settings.keyPressOffset)
.replace('u', (parseInt(settings.startOctave, 10) + settings.keyPressOffset + 1)
.replace('l', parseInt(settings.keyOctave, 10) + settings.keyPressOffset)
.replace('u', (parseInt(settings.keyOctave, 10) + settings.keyPressOffset + 1)
.toString());
};

Expand Down Expand Up @@ -530,6 +556,17 @@
// Placeholder function.
};

this.setKeyOctave = function(octave){
// Placeholder function.
};

this.getKeyOctave = function(){};
this.keyOctaveUp = function(){};
this.keyOctaveDown = function(){};

this.getKeyMap = function(){};
this.setKeyMap = function(newKeyMap){};

init.call(this, settings);
};

Expand Down
4 changes: 2 additions & 2 deletions dist/qwerty-hancock.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "qwerty-hancock",
"title": "Qwerty Hancock",
"description": "An interactive HTML plugin-free keyboard for your web audio project.",
"version": "0.6.0",
"version": "0.6.1",
"main": "dist/qwerty-hancock.js",
"repository": {
"type": "git",
Expand Down
5 changes: 3 additions & 2 deletions src/qwerty-hancock.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Qwerty Hancock keyboard library v0.6.0
* Qwerty Hancock keyboard library v0.6.1
* The web keyboard for now people.
* Copyright 2012-18, Stuart Memo
*
Expand All @@ -15,7 +15,7 @@
* In node context (browserify), `this` is the node global.
*/
var globalWindow = typeof global === 'undefined' ? root : root.window;
var version = '0.6.0',
var version = '0.6.1',
settings = {},
mouse_is_down = false,
keysDown = {},
Expand Down Expand Up @@ -261,6 +261,7 @@
el.style.margin = 0;
el.style.width = settings.width + 'px';
el.style['-webkit-user-select'] = 'none';
el.style.boxSizing = 'content-box';
};

styleElement(keyboard.container);
Expand Down

0 comments on commit 2cf4ce3

Please sign in to comment.