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

Fixed small issue with parent container size #43

Merged
merged 2 commits into from
Oct 1, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
### Changelog

#### 3.5.3

##### Fixes

- Fixes an issue where falling back to the dimensions of the color picker's container element wasn't working. Thanks @DenVys for the contribution!

#### 3.5.2

##### Fixes
Expand Down
17 changes: 13 additions & 4 deletions dist/iro.es.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* iro.js v3.5.2
* iro.js v3.5.3
* 2016-2018 James Daniel
* Released under the MIT License
* github.com/jaames/iro.js
Expand Down Expand Up @@ -1156,8 +1156,17 @@ colorPicker.prototype._mount = function _mount (el, opts) {
el = "string" == typeof el ? document.querySelector(el) : el; // Find the width and height for the UI
// If not defined in the options, try the HTML width + height attributes of the wrapper, else default to 320

var width = opts.width || parseInt(el.width) || 320;
var height = opts.height || parseInt(el.height) || 320; // Calculate layout variables
var elWidth = parseInt(getComputedStyle(el).width);
var elHeight = parseInt(getComputedStyle(el).height); //choose the smallest side of the container

if (elHeight < elWidth && elHeight != 0) {
elWidth = elHeight;
} else if (elWidth != 0) {
elHeight = elWidth;
}

var width = opts.width || elWidth || 320;
var height = opts.height || elHeight || 320; // Calculate layout variables

var padding = opts.padding + 2 || 6,
borderWidth = opts.borderWidth || 0,
Expand Down Expand Up @@ -1354,7 +1363,7 @@ var iro = {
Color: color,
ColorPicker: colorPicker,
Stylesheet: stylesheet,
version: "3.5.2"
version: "3.5.3"
};

export default iro;
17 changes: 13 additions & 4 deletions dist/iro.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* iro.js v3.5.2
* iro.js v3.5.3
* 2016-2018 James Daniel
* Released under the MIT License
* github.com/jaames/iro.js
Expand Down Expand Up @@ -1162,8 +1162,17 @@
el = "string" == typeof el ? document.querySelector(el) : el; // Find the width and height for the UI
// If not defined in the options, try the HTML width + height attributes of the wrapper, else default to 320

var width = opts.width || parseInt(el.width) || 320;
var height = opts.height || parseInt(el.height) || 320; // Calculate layout variables
var elWidth = parseInt(getComputedStyle(el).width);
var elHeight = parseInt(getComputedStyle(el).height); //choose the smallest side of the container

if (elHeight < elWidth && elHeight != 0) {
elWidth = elHeight;
} else if (elWidth != 0) {
elHeight = elWidth;
}

var width = opts.width || elWidth || 320;
var height = opts.height || elHeight || 320; // Calculate layout variables

var padding = opts.padding + 2 || 6,
borderWidth = opts.borderWidth || 0,
Expand Down Expand Up @@ -1360,7 +1369,7 @@
Color: color,
ColorPicker: colorPicker,
Stylesheet: stylesheet,
version: "3.5.2"
version: "3.5.3"
};

return iro;
Expand Down
4 changes: 2 additions & 2 deletions dist/iro.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/iro.min.js.map

Large diffs are not rendered by default.

17 changes: 13 additions & 4 deletions docs/.vuepress/theme/js/iro.es.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* iro.js v3.5.2
* iro.js v3.5.3
* 2016-2018 James Daniel
* Released under the MIT License
* github.com/jaames/iro.js
Expand Down Expand Up @@ -1156,8 +1156,17 @@ colorPicker.prototype._mount = function _mount (el, opts) {
el = "string" == typeof el ? document.querySelector(el) : el; // Find the width and height for the UI
// If not defined in the options, try the HTML width + height attributes of the wrapper, else default to 320

var width = opts.width || parseInt(el.width) || 320;
var height = opts.height || parseInt(el.height) || 320; // Calculate layout variables
var elWidth = parseInt(getComputedStyle(el).width);
var elHeight = parseInt(getComputedStyle(el).height); //choose the smallest side of the container

if (elHeight < elWidth && elHeight != 0) {
elWidth = elHeight;
} else if (elWidth != 0) {
elHeight = elWidth;
}

var width = opts.width || elWidth || 320;
var height = opts.height || elHeight || 320; // Calculate layout variables

var padding = opts.padding + 2 || 6,
borderWidth = opts.borderWidth || 0,
Expand Down Expand Up @@ -1354,7 +1363,7 @@ var iro = {
Color: color,
ColorPicker: colorPicker,
Stylesheet: stylesheet,
version: "3.5.2"
version: "3.5.3"
};

export default iro;
2 changes: 1 addition & 1 deletion package-lock.json

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
@@ -1,6 +1,6 @@
{
"name": "@jaames/iro",
"version": "3.5.2",
"version": "3.5.3",
"description": "A sleek and lightweight JS color picker - with zero dependencies",
"module": "dist/iro.es.js",
"main": "dist/iro.js",
Expand Down
13 changes: 11 additions & 2 deletions src/modules/colorPicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,17 @@ export default class colorPicker {
el = ("string" == typeof el) ? document.querySelector(el) : el;
// Find the width and height for the UI
// If not defined in the options, try the HTML width + height attributes of the wrapper, else default to 320
var width = opts.width || parseInt(el.width) || 320;
var height = opts.height || parseInt(el.height) || 320;
var elWidth = parseInt(getComputedStyle(el).width);
var elHeight = parseInt(getComputedStyle(el).height);
//choose the smallest side of the container
if(elHeight < elWidth && elHeight != 0) {
elWidth = elHeight;
}
else if(elWidth != 0) {
elHeight = elWidth;
}
var width = opts.width || elWidth || 320;
var height = opts.height || elHeight || 320;
// Calculate layout variables
var padding = opts.padding + 2 || 6,
borderWidth = opts.borderWidth || 0,
Expand Down