diff --git a/README.CN.md b/README.CN.md index b811fa9..03e2a45 100644 --- a/README.CN.md +++ b/README.CN.md @@ -137,6 +137,13 @@ TagCloud(container, texts, options); 鼠标移除容器区域时是否保持继续滚动。默认为是 `true`,减速至初始滚动速度,然后继续随鼠标滚动。 +##### options.reverseDirection + +类型: `Boolean`\ +默认值: `false` + +当鼠标控制方向时,是否要逆转方向。 + ##### options.containerClass 类型: `String`\ diff --git a/dist/TagCloud.js b/dist/TagCloud.js index 6935cb2..0ebcab0 100644 --- a/dist/TagCloud.js +++ b/dist/TagCloud.js @@ -1,6 +1,6 @@ /*! - * TagCloud.js v2.4.0 - * Copyright (c) 2016-2023 @ Cong Min + * TagCloud.js v2.5.0 + * Copyright (c) 2016-2024 @ Cong Min * MIT License - https://github.com/mcc108/TagCloud */ (function (global, factory) { @@ -298,6 +298,12 @@ var a = -(Math.min(Math.max(-self.mouseY, -self.size), self.size) / self.radius) * self.maxSpeed; var b = Math.min(Math.max(-self.mouseX, -self.size), self.size) / self.radius * self.maxSpeed; + + // inverse direction if enabled + if (self.config.reverseDirection) { + a = -a; + b = -b; + } if (Math.abs(a) <= 0.01 && Math.abs(b) <= 0.01) return; // pause // calculate offset @@ -424,6 +430,7 @@ // rolling init direction, unit clockwise `deg`, optional: `0`(top) , `90`(left), `135`(right-bottom)(default)... keep: true, // whether to keep rolling after mouse out area, optional: `false`, `true`(default)(decelerate to rolling init speed, and keep rolling with mouse) + reverseDirection: false, useContainerInlineStyles: true, useItemInlineStyles: true, containerClass: 'tagcloud', diff --git a/dist/TagCloud.min.js b/dist/TagCloud.min.js index 354a58f..d3dd3de 100644 --- a/dist/TagCloud.min.js +++ b/dist/TagCloud.min.js @@ -1,6 +1,6 @@ /*! - * TagCloud.js v2.4.0 - * Copyright (c) 2016-2023 @ Cong Min + * TagCloud.js v2.5.0 + * Copyright (c) 2016-2024 @ Cong Min * MIT License - https://github.com/mcc108/TagCloud */ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).TagCloud=t()}(this,function(){"use strict";function t(t,e){var n,i=Object.keys(t);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(t),e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),i.push.apply(i,n)),i}function a(i){for(var e=1;e