diff --git a/README.md b/README.md index 019bd5e..b370d01 100644 --- a/README.md +++ b/README.md @@ -80,4 +80,4 @@ When the image has loaded ## Example -See [test/index.html](test/index.html) +See [example/index.html](example/index.html) diff --git a/bower.json b/bower.json index 3b3e08b..494b6ab 100644 --- a/bower.json +++ b/bower.json @@ -14,5 +14,5 @@ "test", "tests" ], - "version": "1.0.0" + "version": "1.0.1" } diff --git a/test/index.html b/example/index.html similarity index 100% rename from test/index.html rename to example/index.html diff --git a/index.js b/index.js index 03e815c..69d5f65 100644 --- a/index.js +++ b/index.js @@ -45,12 +45,12 @@ function ImageLoader(grid, imagePath, width, height, swatchColor, onclick, callb if (self.image.width > self.image.height) { diff = gridWidth / self.image.width; - self.display.width = self.image.width * diff; - self.display.height = self.image.height * diff; + self.display.width = Math.ceil(self.image.width * diff); + self.display.height = Math.ceil(self.image.height * diff); } else { - diff = gridWidth / self.image.height; - self.display.width = gridWidth; - self.display.height = self.image.height * diff; + diff = gridWidth / self.image.width; + self.display.width = Math.ceil(gridWidth); + self.display.height = Math.ceil(self.image.height * diff); } }; diff --git a/node_modules/.bin/nodeunit b/node_modules/.bin/nodeunit new file mode 120000 index 0000000..f31cdbe --- /dev/null +++ b/node_modules/.bin/nodeunit @@ -0,0 +1 @@ +../nodeunit/bin/nodeunit \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..c9c5474 --- /dev/null +++ b/package.json @@ -0,0 +1,19 @@ +{ + "name": "smartimageloader", + "version": "1.0.1", + "description": "``` new ImageLoader(GridID, ImageUrl, Width, Height, PreloadBackgroundHex, OnClick, Callback) ```", + "main": "index.js", + "directories": { + "test": "tests" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/dwnz/image-loader.git" + }, + "author": "DWNZ", + "license": "MIT", + "bugs": { + "url": "https://github.com/dwnz/image-loader/issues" + }, + "homepage": "https://github.com/dwnz/image-loader#readme" +} diff --git a/test/test.html b/test/test.html new file mode 100644 index 0000000..fb5732d --- /dev/null +++ b/test/test.html @@ -0,0 +1,157 @@ + + + + + smartimageloader tests + + + +
+
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + \ No newline at end of file