diff --git a/dist/CommentCoreLibrary.js b/dist/CommentCoreLibrary.js index 1e44f861..d36d8531 100644 --- a/dist/CommentCoreLibrary.js +++ b/dist/CommentCoreLibrary.js @@ -528,14 +528,11 @@ var CoreComment = (function () { else { this.dom = document.createElement('div'); } - this.dom.className = this.parent.options.global.className; - if (this._className !== "") { - this.dom.className += " " + this._className; - } this.dom.appendChild(document.createTextNode(this.text)); this.dom.textContent = this.text; this.dom.innerText = this.text; this.size = this._size; + this.className = this._className; if (this._color != 0xffffff) { this.color = this._color; } @@ -660,7 +657,7 @@ var CoreComment = (function () { }); Object.defineProperty(CoreComment.prototype, "width", { get: function () { - if (this._width === null || this._width === undefined) { + if (typeof this._width === 'undefined' || this._width === null) { this._width = this.dom.offsetWidth; } return this._width; @@ -674,7 +671,7 @@ var CoreComment = (function () { }); Object.defineProperty(CoreComment.prototype, "height", { get: function () { - if (this._height === null || this._height === undefined) { + if (typeof this._height === 'undefined' || this._height === null) { this._height = this.dom.offsetHeight; } return this._height; @@ -719,7 +716,8 @@ var CoreComment = (function () { }, set: function (a) { this._alpha = a; - this.dom.style.opacity = Math.min(this._alpha, this.parent.options.global.opacity) + ''; + this.dom.style.opacity = + Math.min(this._alpha, this.parent.options.global.opacity) + ''; }, enumerable: true, configurable: true @@ -782,6 +780,17 @@ var CoreComment = (function () { enumerable: true, configurable: true }); + Object.defineProperty(CoreComment.prototype, "className", { + get: function () { + return this._className; + }, + set: function (className) { + this._className = className; + this.dom.className = this.parent.options.global.className + ' ' + className; + }, + enumerable: true, + configurable: true + }); CoreComment.prototype.time = function (time) { this.ttl -= time; if (this.ttl < 0) { @@ -1152,7 +1161,7 @@ var CommentUtils; get: function () { return this._internalArray.slice(0); }, - set: function (array) { + set: function (_array) { throw new Error('Not permitted. Matrices are immutable.'); }, enumerable: true, @@ -1198,18 +1207,19 @@ var CommentUtils; return new Matrix3D([xscale, 0, 0, 0, 0, yscale, 0, 0, 0, 0, zscale, 0, 0, 0, 0, 1]); }; Matrix3D.createRotationMatrix = function (xrot, yrot, zrot) { + var COS = Math.cos; + var SIN = Math.sin; var DEG2RAD = Math.PI / 180; + var xr = xrot * DEG2RAD; var yr = yrot * DEG2RAD; var zr = zrot * DEG2RAD; - var COS = Math.cos; - var SIN = Math.sin; var matrix = [ - COS(yr) * COS(zr), COS(yr) * SIN(zr), SIN(yr), 0, - (-SIN(zr)), COS(zr), 0, 0, - (-SIN(yr) * COS(zr)), (-SIN(yr) * SIN(zr)), COS(yr), 0, + COS(yr) * COS(zr), COS(yr) * SIN(zr), -SIN(yr), 0, + SIN(xr) * SIN(yr) * COS(zr) - COS(xr) * SIN(zr), SIN(xr) * SIN(yr) * SIN(zr) + COS(xr) * COS(zr), SIN(xr) * COS(yr), 0, + COS(xr) * SIN(yr) * COS(zr) + SIN(xr) * SIN(zr), COS(xr) * SIN(yr) * SIN(zr) - SIN(xr) * COS(zr), COS(xr) * COS(yr), 0, 0, 0, 0, 1 ]; - return new Matrix3D(matrix.map(function (v) { return Math.round(v * 1e10) * 1e-10; })); + return new Matrix3D(matrix); }; return Matrix3D; }()); @@ -1226,17 +1236,6 @@ var __extends = (this && this.__extends) || (function () { d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); -var CssCompatLayer = (function () { - function CssCompatLayer() { - } - CssCompatLayer.transform = function (dom, trans) { - dom.style.transform = trans; - dom.style["webkitTransform"] = trans; - dom.style["msTransform"] = trans; - dom.style["oTransform"] = trans; - }; - return CssCompatLayer; -}()); var CssScrollComment = (function (_super) { __extends(CssScrollComment, _super); function CssScrollComment() { @@ -1249,30 +1248,29 @@ var CssScrollComment = (function (_super) { _super.prototype.init.call(this, recycle); this._toggleClass('css-optimize', true); }; + CssScrollComment.prototype._calculateX = function () { + var width = (typeof this._width === 'undefined') ? 0 : this.width; + var x = (this.ttl / this.dur) * (this.parent.width + width) - width; + return (!this.absolute) ? (x / this.parent.width) : x; + }; Object.defineProperty(CssScrollComment.prototype, "x", { get: function () { - return (this.ttl / this.dur) * (this.parent.width + this.width) - this.width; + return this._calculateX(); }, set: function (x) { - if (this._x !== null && typeof this._x === "number") { - var dx = x - this._x; - this._x = x; - CssCompatLayer.transform(this.dom, "translateX(" + - (this.axis % 2 === 0 ? dx : -dx) + "px)"); + if (!this.absolute) { + x *= this.parent.width; + } + var dx = x - this._calculateX(); + this.dom.style.transform = + "translateX(" + (this.axis % 2 === 0 ? dx : -dx) + "px)" + + (this._transform === null || this._transform.isIdentity() ? + '' : (' ' + this._transform.toCss())); + if (this.axis % 2 === 0) { + this.dom.style.left = this._calculateX() + 'px'; } else { - this._x = x; - if (!this.absolute) { - this._x *= this.parent.width; - } - if (this.axis % 2 === 0) { - this.dom.style.left = - (this._x + (this.align % 2 === 0 ? 0 : -this.width)) + 'px'; - } - else { - this.dom.style.right = - (this._x + (this.align % 2 === 0 ? -this.width : 0)) + 'px'; - } + this.dom.style.right = this._calculateX() + 'px'; } }, enumerable: true, @@ -1281,21 +1279,24 @@ var CssScrollComment = (function (_super) { CssScrollComment.prototype.update = function () { if (this._dirtyCSS) { this.dom.style.transition = "transform " + this.ttl + "ms linear"; - this.x = -this.width; + this.x = -this.dom.offsetWidth; this._dirtyCSS = false; } }; CssScrollComment.prototype.invalidate = function () { _super.prototype.invalidate.call(this); this._dirtyCSS = true; + if (!this.dom) { + return; + } + else { + this.dom.style.transition = ''; + this.x = this.x; + } }; CssScrollComment.prototype.stop = function () { _super.prototype.stop.call(this); - this.dom.style.transition = ''; - this.x = this._x; - this._x = null; - this.x = this.x; - this._dirtyCSS = true; + this.invalidate(); }; return CssScrollComment; }(ScrollComment)); diff --git a/dist/CommentCoreLibrary.min.js b/dist/CommentCoreLibrary.min.js index d1872c04..bb9c1a7b 100644 --- a/dist/CommentCoreLibrary.min.js +++ b/dist/CommentCoreLibrary.min.js @@ -1,2 +1,2 @@ /*!Copyright(c) CommentCoreLibrary v0.11.1 (//github.com/jabbany/CommentCoreLibrary) - Licensed under the MIT License */ -var CommentUtils,BinArray=function(){var n={bsearch:function(t,e,r){if(!Array.isArray(t))throw new Error("Bsearch can only be run on arrays");if(0===t.length)return 0;if(r(e,t[0])<0)return 0;if(0<=r(e,t[t.length-1]))return t.length;for(var i=0,n=0,o=0,s=t.length-1;i<=s;){if(o++,0<=r(e,t[(n=math.floor((s+i+1)/2))-1])&&r(e,t[n])<0)return n;if(r(e,t[n-1])<0)s=n-1;else{if(!(0<=r(e,t[n])))throw new Error("Program Error. Inconsistent comparator or unsorted array!");i=n}if(1500e.stime?2:t.stimee.date?1:t.datee.dbid?1:t.dbide.stime?1:0})},t.prototype.validate=function(t){return null!=t&&this.filter.doValidate(t)},t.prototype.load=function(t){this.timeline=t,this.timeline.sort(e),this.dispatchEvent("load")},t.prototype.insert=function(t){BinArray.binsert(this.timeline,t,e)<=this.position&&this.position++,this.dispatchevent("insert")},t.prototype.clear=function(){for(;0=this.timeline.length||Math.abs(this._lastPosition-t)>=this.options.seekTrigger){if(this.seek(t),this._lastPosition=t,this.timeline.length<=this.position)return}else this._lastPosition=t;for(var e=[];this.position=this.options.limit||this.validate(this.timeline[this.position])&&e.push(this.timeline[this.position]);0this._motionEnd[this._curMotion]?(this._curMotion++,void(this._curMotion>=this.motion.length&&(this._curMotion=this.motion.length-1))):void 0}},a.prototype.stop=function(){},a.prototype.finish=function(){this.parent.finish(this)},a.prototype.toString=function(){return["[",this.stime,"|",this.ttl,"/",this.dur,"]","(",this.mode,")",this.text].join("")},a.LINEAR=function(t,e,r,i){return t*r/i+e},a}(),ScrollComment=function(i){function t(t,e){var r=i.call(this,t,e)||this;return r.dur*=r.parent.options.scroll.scale,r.ttl*=r.parent.options.scroll.scale,r}return __extends(t,i),Object.defineProperty(t.prototype,"alpha",{set:function(t){this._alpha=t,this.dom.style.opacity=Math.min(Math.min(this._alpha,this.parent.options.global.opacity),this.parent.options.scroll.opacity)+""},enumerable:!0,configurable:!0}),t.prototype.init=function(t){void 0===t&&(t=null),i.prototype.init.call(this,t),this.x=this.parent.width,this.parent.options.scroll.opacity<1&&(this.alpha=this._alpha),this.absolute=!0},t.prototype.update=function(){this.x=this.ttl/this.dur*(this.parent.width+this.width)-this.width},t}(corecomment),commentfactory=function(){function e(){this._bindings={}}return e._simpleCssScrollingInitializer=function(t,e){var r=new CssScrollComment(t,e);switch(r.mode){case 1:r. 2:r. 6:r. r.init(),t.stage.appendChild(r.dom),r},e._simpleScrollingInitializer=function(t,e){var r=new ScrollComment(t,e);switch(r.mode){case 1:r. 2:r. 6:r. r.init(),t.stage.appendChild(r.dom),r},e._simpleAnchoredInitializer=function(t,e){var r=new CoreComment(t,e);switch(r.mode){case 4:r. 5:r. r.init(),t.stage.appendChild(r.dom),r},e._advancedCoreInitializer=function(t,e){var r=new CoreComment(t,e);return r.init(),r.transform=CommentUtils.Matrix3D.createRotationMatrix(0,e.rY,e.rZ).flatArray,t.stage.appendChild(r.dom),r},e.defaultFactory=function(){var t=new e;return t.bind(1,e._simpleScrollingInitializer),t.bind(2,e._simpleScrollingInitializer),t.bind(6,e._simpleScrollingInitializer),t.bind(4,e._simpleAnchoredInitializer),t.bind(5,e._simpleAnchoredInitializer),t.bind(7,e._advancedCoreInitializer),t.bind(17,e._advancedCoreInitializer),t},e.defaultCssRenderFactory=function(){var t=new e;return t.bind(1,e._simpleCssScrollingInitializer),t.bind(2,e._simpleCssScrollingInitializer),t.bind(6,e._simpleCssScrollingInitializer),t.bind(4,e._simpleAnchoredInitializer),t.bind(5,e._simpleAnchoredInitializer),t.bind(7,e._advancedCoreInitializer),t.bind(17,e._advancedCoreInitializer),t},e.defaultCanvasRenderFactory=function(){throw new Error("Not implemented")},e.defaultSvgRenderFactory=function(){throw new Error("Not implemented")},e.prototype.bind=function(t,e){this._bindings[t]=e},e.prototype.canCreate=function(t){return this._bindings.hasOwnProperty(t.mode)},e.prototype.create=function(t,e){if(null===e||!e.hasOwnProperty("mode"))throw new Error("Comment format incorrect");if(!this._bindings.hasOwnProperty(e.mode))throw new Error("No binding for comment type "+e.mode);return this._bindings[e.mode](t,e)},e}(),CommentSpaceAllocator=(__extends=this&&this.__extends||function(){var i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(t,e){function r(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),function(){function t(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this._pools=[[]],this.avoid=1,this._ t.prototype.willCollide=function(t,e){return t.stime+t.ttl>=e.stime+e.ttl/2},t.prototype.pathCheck=function(t,e,r){for(var i=t+e.height,n=e.right,o=0;oi||r[o].bottomn))return!1;if(this.willCollide(r[o],e))return!1}return!0},t.prototype.assign=function(t,e){for(;this._pools.length<=e;)this._pools.push([]);var r=this._pools[e];if(0===r.length)return t.cindex=e,0;if(this.pathCheck(0,t,r))return t.cindex=e,0;for(var i=0,n=0;nthis._height);n++)if(this.pathCheck(i,t,r))return t.cindex=e,i;return this.assign(t,e+1)},t.prototype.add=function(t){t.height>this._height?(t.cindex=-2,t.y=0):(t.y=this.assign(t,0),BinArray.binsert(this._pools[t.cindex],t,function(t,e){return t.bottome.bottom?1:0}))},t.prototype.remove=function(t){if(!(t.cindex<0)){if(t.cindex>=this._pools.length)throw new Error("cindex out of bounds");var e=this._pools[t.cindex].indexOf(t);e<0||this._pools[t.cindex].splice(e,1)}},t.prototype.setbounds=function(t,e){this._ t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.prototype.add=function(t){e.prototype.add.call(this,t),t.x=(this._width-t.width)/2},t.prototype.willCollide=function(t,e){return!0},t.prototype.pathCheck=function(t,e,r){for(var i=t+e.height,n=0;ni||r[n].bottom":return n>t.value;case"~":case"regexp":return new RegExp(t.value).test(n.toString());case"=":case"eq":return t.value===("number"==typeof n?n:n.toString());case"!":case"not":return!e(t.value,n);case"&&":case"and":return!!Array.isArray(t.value)&&t.value.every(function(t){return e(t,n)});case"||":case"or":return!!Array.isArray(t.value)&&t.value.some(function(t){return e(t,n)});default:return!1}}(t,r)}catch(t){e=!1}return"accept"===t.mode?e:!e}))},t.prototype.addRule=function(t){if("accept"!==t.mode&&"reject"!==t.mode)throw new Error("Rule must be of accept type or reject type.");this.rules.push(t)},t.prototype.removeRule=function(t){var e=this.rules.indexOf(t);return 0<=e&&(this.rules.splice(e,1),!0)},t.prototype.addmodifier=function(t){if("function"!=typeof t)throw new Error("Modifiers need to be functions.");this.modifiers.push(t)},t}(),CommentProvider=function(){function n(){this._started=!1,this._destroyed=!1,this._staticSources={},this._dynamicSources={},this._parsers={},this._targets=[]}return n.SOURCE_JSON="JSON",n.SOURCE_XML="XML",n.SOURCE_,n.BaseHttpProvider=function(s,a,h,l,c){return new Promise(function(t,e){var r=new XMLHttpRequest,i=a;if(l&&("POST"===s||"PUT"===s)){i+="?";var n=[];for(var o in l)l.hasOwnProperty(o)&&n.push(encodeURIComponent(o)+"="+encodeURIComponent(l[o]));i+=n.join("&")}r. Error(this.status+" "+this.statusText))},r.onerror=function(){e(new Error(this.status+" "+this.statusText))},r.open(s,i),r.responseType="string"==typeof h?h:"",void 0!==c?r.send(c):r.send()})},n.JSONProvider=function(t,e,r,i){return n.BaseHttpProvider(t,e,"json",r,i).then(function(t){return t})},n.XMLProvider=function(t,e,r,i){return n.BaseHttpProvider(t,e,"document",r,i).then(function(t){return t})},n.TextProvider=function(t,e,r,i){return n.BaseHttpProvider(t,e,"text",r,i).then(function(t){return t})},n.prototype.addStaticSource=function(t,e){if(this._destroyed)throw new Error("Comment provider has been destroyed, cannot attach more sources.");return e in this._staticSources||(this._staticSources[e]=[]),this._staticSources[e].push(t),this},n.prototype.addDynamicSource=function(t,e){if(this._destroyed)throw new Error("Comment provider has been destroyed, cannot attach more sources.");return e in this._dynamicSources||(this._dynamicSources[e]=[]),this._dynamicSources[e].push(t),this},n.prototype.add new Error("Comment provider has been destroyed, cannot attach more targets.");if(!(t instanceof CommentManager))throw new Error("Expected the target to be an instance of CommentManager.");return this._targets.push(t),this},n.prototype.addParser=function(t,e){if(this._destroyed)throw new Error("Comment provider has been destroyed, cannot attach more parsers.");return e in this._parsers||(this._parsers[e]=[]),this._parsers[e].unshift(t),this},n.prototype.applyParsersOne=function(n,o){return new Promise(function(t,e){if(o in this._parsers){for(var r=0;re.stime?2:t.stimee.date?1:t.datee.dbid?1:t.dbide.stime?1:0})},t.prototype.validate=function(t){return null!=t&&this.filter.doValidate(t)},t.prototype.load=function(t){this.timeline=t,this.timeline.sort(e),this.dispatchEvent("load")},t.prototype.insert=function(t){BinArray.binsert(this.timeline,t,e)<=this.position&&this.position++,this.dispatchevent("insert")},t.prototype.clear=function(){for(;0=this.timeline.length||Math.abs(this._lastPosition-t)>=this.options.seekTrigger){if(this.seek(t),this._lastPosition=t,this.timeline.length<=this.position)return}else this._lastPosition=t;for(var e=[];this.position=this.options.limit||this.validate(this.timeline[this.position])&&e.push(this.timeline[this.position]);0this._motionEnd[this._curMotion]?(this._curMotion++,void(this._curMotion>=this.motion.length&&(this._curMotion=this.motion.length-1))):void 0}},a.prototype.stop=function(){},a.prototype.finish=function(){this.parent.finish(this)},a.prototype.toString=function(){return["[",this.stime,"|",this.ttl,"/",this.dur,"]","(",this.mode,")",this.text].join("")},a.LINEAR=function(t,e,r,i){return t*r/i+e},a}(),ScrollComment=function(i){function t(t,e){var r=i.call(this,t,e)||this;return r.dur*=r.parent.options.scroll.scale,r.ttl*=r.parent.options.scroll.scale,r}return __extends(t,i),Object.defineProperty(t.prototype,"alpha",{set:function(t){this._alpha=t,this.dom.style.opacity=Math.min(Math.min(this._alpha,this.parent.options.global.opacity),this.parent.options.scroll.opacity)+""},enumerable:!0,configurable:!0}),t.prototype.init=function(t){void 0===t&&(t=null),i.prototype.init.call(this,t),this.x=this.parent.width,this.parent.options.scroll.opacity<1&&(this.alpha=this._alpha),this.absolute=!0},t.prototype.update=function(){this.x=this.ttl/this.dur*(this.parent.width+this.width)-this.width},t}(corecomment),commentfactory=function(){function e(){this._bindings={}}return e._simpleCssScrollingInitializer=function(t,e){var r=new CssScrollComment(t,e);switch(r.mode){case 1:r. 2:r. 6:r. r.init(),t.stage.appendChild(r.dom),r},e._simpleScrollingInitializer=function(t,e){var r=new ScrollComment(t,e);switch(r.mode){case 1:r. 2:r. 6:r. r.init(),t.stage.appendChild(r.dom),r},e._simpleAnchoredInitializer=function(t,e){var r=new CoreComment(t,e);switch(r.mode){case 4:r. 5:r. r.init(),t.stage.appendChild(r.dom),r},e._advancedCoreInitializer=function(t,e){var r=new CoreComment(t,e);return r.init(),r.transform=CommentUtils.Matrix3D.createRotationMatrix(0,e.rY,e.rZ).flatArray,t.stage.appendChild(r.dom),r},e.defaultFactory=function(){var t=new e;return t.bind(1,e._simpleScrollingInitializer),t.bind(2,e._simpleScrollingInitializer),t.bind(6,e._simpleScrollingInitializer),t.bind(4,e._simpleAnchoredInitializer),t.bind(5,e._simpleAnchoredInitializer),t.bind(7,e._advancedCoreInitializer),t.bind(17,e._advancedCoreInitializer),t},e.defaultCssRenderFactory=function(){var t=new e;return t.bind(1,e._simpleCssScrollingInitializer),t.bind(2,e._simpleCssScrollingInitializer),t.bind(6,e._simpleCssScrollingInitializer),t.bind(4,e._simpleAnchoredInitializer),t.bind(5,e._simpleAnchoredInitializer),t.bind(7,e._advancedCoreInitializer),t.bind(17,e._advancedCoreInitializer),t},e.defaultCanvasRenderFactory=function(){throw new Error("Not implemented")},e.defaultSvgRenderFactory=function(){throw new Error("Not implemented")},e.prototype.bind=function(t,e){this._bindings[t]=e},e.prototype.canCreate=function(t){return this._bindings.hasOwnProperty(t.mode)},e.prototype.create=function(t,e){if(null===e||!e.hasOwnProperty("mode"))throw new Error("Comment format incorrect");if(!this._bindings.hasOwnProperty(e.mode))throw new Error("No binding for comment type "+e.mode);return this._bindings[e.mode](t,e)},e}(),CommentSpaceAllocator=(__extends=this&&this.__extends||function(){var i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(t,e){function r(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}}(),function(){function t(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this._pools=[[]],this.avoid=1,this._ t.prototype.willCollide=function(t,e){return t.stime+t.ttl>=e.stime+e.ttl/2},t.prototype.pathCheck=function(t,e,r){for(var i=t+e.height,n=e.right,o=0;oi||r[o].bottomn))return!1;if(this.willCollide(r[o],e))return!1}return!0},t.prototype.assign=function(t,e){for(;this._pools.length<=e;)this._pools.push([]);var r=this._pools[e];if(0===r.length)return t.cindex=e,0;if(this.pathCheck(0,t,r))return t.cindex=e,0;for(var i=0,n=0;nthis._height);n++)if(this.pathCheck(i,t,r))return t.cindex=e,i;return this.assign(t,e+1)},t.prototype.add=function(t){t.height>this._height?(t.cindex=-2,t.y=0):(t.y=this.assign(t,0),BinArray.binsert(this._pools[t.cindex],t,function(t,e){return t.bottome.bottom?1:0}))},t.prototype.remove=function(t){if(!(t.cindex<0)){if(t.cindex>=this._pools.length)throw new Error("cindex out of bounds");var e=this._pools[t.cindex].indexOf(t);e<0||this._pools[t.cindex].splice(e,1)}},t.prototype.setbounds=function(t,e){this._ t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.prototype.add=function(t){e.prototype.add.call(this,t),t.x=(this._width-t.width)/2},t.prototype.willCollide=function(t,e){return!0},t.prototype.pathCheck=function(t,e,r){for(var i=t+e.height,n=0;ni||r[n].bottom":return n>t.value;case"~":case"regexp":return new RegExp(t.value).test(n.toString());case"=":case"eq":return t.value===("number"==typeof n?n:n.toString());case"!":case"not":return!e(t.value,n);case"&&":case"and":return!!Array.isArray(t.value)&&t.value.every(function(t){return e(t,n)});case"||":case"or":return!!Array.isArray(t.value)&&t.value.some(function(t){return e(t,n)});default:return!1}}(t,r)}catch(t){e=!1}return"accept"===t.mode?e:!e}))},t.prototype.addRule=function(t){if("accept"!==t.mode&&"reject"!==t.mode)throw new Error("Rule must be of accept type or reject type.");this.rules.push(t)},t.prototype.removeRule=function(t){var e=this.rules.indexOf(t);return 0<=e&&(this.rules.splice(e,1),!0)},t.prototype.addmodifier=function(t){if("function"!=typeof t)throw new Error("Modifiers need to be functions.");this.modifiers.push(t)},t}(),CommentProvider=function(){function n(){this._started=!1,this._destroyed=!1,this._staticSources={},this._dynamicSources={},this._parsers={},this._targets=[]}return n.SOURCE_JSON="JSON",n.SOURCE_XML="XML",n.SOURCE_,n.BaseHttpProvider=function(s,a,h,l,c){return new Promise(function(t,e){var r=new XMLHttpRequest,i=a;if(l&&("POST"===s||"PUT"===s)){i+="?";var n=[];for(var o in l)l.hasOwnProperty(o)&&n.push(encodeURIComponent(o)+"="+encodeURIComponent(l[o]));i+=n.join("&")}r. Error(this.status+" "+this.statusText))},r.onerror=function(){e(new Error(this.status+" "+this.statusText))},r.open(s,i),r.responseType="string"==typeof h?h:"",void 0!==c?r.send(c):r.send()})},n.JSONProvider=function(t,e,r,i){return n.BaseHttpProvider(t,e,"json",r,i).then(function(t){return t})},n.XMLProvider=function(t,e,r,i){return n.BaseHttpProvider(t,e,"document",r,i).then(function(t){return t})},n.TextProvider=function(t,e,r,i){return n.BaseHttpProvider(t,e,"text",r,i).then(function(t){return t})},n.prototype.addStaticSource=function(t,e){if(this._destroyed)throw new Error("Comment provider has been destroyed, cannot attach more sources.");return e in this._staticSources||(this._staticSources[e]=[]),this._staticSources[e].push(t),this},n.prototype.addDynamicSource=function(t,e){if(this._destroyed)throw new Error("Comment provider has been destroyed, cannot attach more sources.");return e in this._dynamicSources||(this._dynamicSources[e]=[]),this._dynamicSources[e].push(t),this},n.prototype.add new Error("Comment provider has been destroyed, cannot attach more targets.");if(!(t instanceof CommentManager))throw new Error("Expected the target to be an instance of CommentManager.");return this._targets.push(t),this},n.prototype.addParser=function(t,e){if(this._destroyed)throw new Error("Comment provider has been destroyed, cannot attach more parsers.");return e in this._parsers||(this._parsers[e]=[]),this._parsers[e].unshift(t),this},n.prototype.applyParsersOne=function(n,o){return new Promise(function(t,e){if(o in this._parsers){for(var r=0;r=0.5.1" } }, - "fd-slicer": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.0.1.tgz", - "integrity": "sha1-i1vL2ewyfFBBv5qwI/1nUPEXfmU=", - "dev": true, - "requires": { - "pend": "~1.2.0" - } - }, "figgy-pudding": { "version": "3.5.1", "resolved": "https://registry.npmjs.org/figgy-pudding/-/figgy-pudding-3.5.1.tgz", @@ -1696,15 +1752,6 @@ "readable-stream": "^2.0.0" } }, - "fs-minipass": { - "version": "1.2.6", - "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-1.2.6.tgz", - "integrity": "sha512-crhvyXcMejjv3Z5d2Fa9sf5xLYVCF5O1c71QxbVnbLsmYMBEvDAftewesN/HhY03YRoA7zOMxjNGrF5svGaaeQ==", - "dev": true, - "requires": { - "minipass": "^2.2.1" - } - }, "fs-write-stream-atomic": { "version": "1.0.10", "resolved": "https://registry.npmjs.org/fs-write-stream-atomic/-/fs-write-stream-atomic-1.0.10.tgz", @@ -1770,15 +1817,12 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", - "dev": true, "optional": true }, "brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, - "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -1800,7 +1844,6 @@ "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", - "dev": true, "optional": true }, "console-control-strings": { @@ -1940,13 +1983,6 @@ "dev": true, "optional": true }, - "ini": { - "version": "1.3.5", - "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz", - "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==", - "dev": true, - "optional": true - }, "is-fullwidth-code-point": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", @@ -1964,23 +2000,6 @@ "dev": true, "optional": true }, - "minimatch": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", - "dev": true, - "optional": true, - "requires": { - "brace-expansion": "^1.1.7" - } - }, - "minimist": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", - "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", - "dev": true, - "optional": true - }, "minipass": { "version": "2.3.5", "resolved": "https://registry.npmjs.org/minipass/-/minipass-2.3.5.tgz", @@ -2000,13 +2019,13 @@ } }, "mkdirp": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", - "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "version": "0.5.6", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz", + "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==", "dev": true, "optional": true, "requires": { - "minimist": "0.0.8" + "minimist": "^1.2.6" } }, "ms": { @@ -2163,15 +2182,6 @@ "ini": "~1.3.0", "minimist": "^1.2.0", "strip-json-comments": "~2.0.1" - }, - "dependencies": { - "minimist": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", - "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", - "dev": true, - "optional": true - } } }, "readable-stream": { @@ -2312,6 +2322,12 @@ } } }, + "function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "dev": true + }, "functional-red-black-tree": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", @@ -2355,9 +2371,9 @@ "dev": true }, "getobject": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/getobject/-/getobject-1.0.0.tgz", - "integrity": "sha512-tbUz6AKKKr2YiMB+fLWIgq5ZeBOobop9YMMAU9dC54/ot2ksMXt3DOFyBuhZw6ptcVszEykgByK20j7W9jHFag==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/getobject/-/getobject-1.0.2.tgz", + "integrity": "sha512-2zblDBaFcb3rB4rF77XVnuINOE2h2k/OnqXAiy0IrTxUfV1iFp3la33oAQVY9pCpWU268WFYVt2t71hlMuLsOg==", "dev": true }, "getpass": { @@ -2474,9 +2490,9 @@ "dev": true }, "grunt": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/grunt/-/grunt-1.3.0.tgz", - "integrity": "sha512-6ILlMXv11/4cxuhSMfSU+SfvbxrPuqZrAtLN64+tZpQ3DAKfSQPQHRbTjSbdtxfyQhGZPtN0bDZJ/LdCM5WXXA==", + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/grunt/-/grunt-1.5.3.tgz", + "integrity": "sha512-mKwmo4X2d8/4c/BmcOETHek675uOqw0RuA/zy12jaspWqvTp4+ZeQF1W+OTpcbncnaBsfbQJ6l0l4j+Sn/GmaQ==", "dev": true, "requires": { "dateformat": "~3.0.3", @@ -2484,10 +2500,10 @@ "exit": "~0.1.2", "findup-sync": "~0.3.0", "glob": "~7.1.6", - "grunt-cli": "~1.3.2", - "grunt-known-options": "~1.1.0", + "grunt-cli": "~1.4.3", + "grunt-known-options": "~2.0.0", "grunt-legacy-log": "~3.0.0", - "grunt-legacy-util": "~2.0.0", + "grunt-legacy-util": "~2.0.1", "iconv-lite": "~0.4.13", "js-yaml": "~3.14.0", "minimatch": "~3.0.4", @@ -2497,16 +2513,16 @@ }, "dependencies": { "grunt-cli": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/grunt-cli/-/grunt-cli-1.3.2.tgz", - "integrity": "sha512-8OHDiZZkcptxVXtMfDxJvmN7MVJNE8L/yIcPb4HB7TlyFD1kDvjHrb62uhySsU14wJx9ORMnTuhRMQ40lH/orQ==", + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/grunt-cli/-/grunt-cli-1.4.3.tgz", + "integrity": "sha512-9Dtx/AhVeB4LYzsViCjUQkd0Kw0McN2gYpdmGYKtE2a5Yt7v1Q+HYZVWhqXc/kGnxlMtqKDxSwotiGeFmkrCoQ==", "dev": true, "requires": { - "grunt-known-options": "~1.1.0", + "grunt-known-options": "~2.0.0", "interpret": "~1.1.0", - "liftoff": "~2.5.0", + "liftup": "~3.0.1", "nopt": "~4.0.1", - "v8flags": "~3.1.1" + "v8flags": "~3.2.0" }, "dependencies": { "nopt": { @@ -2531,12 +2547,6 @@ "esprima": "^4.0.0" } }, - "mkdirp": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", - "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", - "dev": true - }, "rimraf": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", @@ -2598,12 +2608,12 @@ }, "dependencies": { "async": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/async/-/async-2.6.2.tgz", - "integrity": "sha512-H1qVYh1MYhEEFLsP97cVKqCGo7KfCyTt6uEWqsTBr9SO84oK9Uwbyd/yCW+6rKJLHksBNUVWZDAjfS+Ccx0Bbg==", + "version": "2.6.4", + "resolved": "https://registry.npmjs.org/async/-/async-2.6.4.tgz", + "integrity": "sha512-mzo5dfJYwAn29PeiJ0zvwTo04zj8HDJj0Mn8TD7sno7q12prdbnasKJHhkm2c1LgrhlJ0teaea8860oxi51mGA==", "dev": true, "requires": { - "lodash": "^4.17.11" + "lodash": "^4.17.14" } } } @@ -2803,15 +2813,6 @@ "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.2.tgz", "integrity": "sha512-VE0SOVEHCk7Qc8ulkWw3ntAzXuqf7S2lvwQaDLRnUeIEaKNQJzV6BwmLKhOqT61aGhfUMrXeaBk+oDGCzvhcug==", "dev": true - }, - "ws": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/ws/-/ws-6.2.1.tgz", - "integrity": "sha512-GIyAXC2cB7LjvpgMt9EKS2ldqr0MTrORaleiOno6TweZ6r3TKtoFQWay/2PceJ3RuBasOHzXNn5Lrw1X0bEjqA==", - "dev": true, - "requires": { - "async-limiter": "~1.0.0" - } } } }, @@ -2851,12 +2852,12 @@ }, "dependencies": { "async": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/async/-/async-2.6.2.tgz", - "integrity": "sha512-H1qVYh1MYhEEFLsP97cVKqCGo7KfCyTt6uEWqsTBr9SO84oK9Uwbyd/yCW+6rKJLHksBNUVWZDAjfS+Ccx0Bbg==", + "version": "2.6.4", + "resolved": "https://registry.npmjs.org/async/-/async-2.6.4.tgz", + "integrity": "sha512-mzo5dfJYwAn29PeiJ0zvwTo04zj8HDJj0Mn8TD7sno7q12prdbnasKJHhkm2c1LgrhlJ0teaea8860oxi51mGA==", "dev": true, "requires": { - "lodash": "^4.17.11" + "lodash": "^4.17.14" } } } @@ -2872,9 +2873,9 @@ } }, "grunt-known-options": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/grunt-known-options/-/grunt-known-options-1.1.1.tgz", - "integrity": "sha512-cHwsLqoighpu7TuYj5RonnEuxGVFnztcUqTqp5rXFGYL4OuPFofwC4Ycg7n9fYwvK6F5WbYgeVOwph9Crs2fsQ==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/grunt-known-options/-/grunt-known-options-2.0.0.tgz", + "integrity": "sha512-GD7cTz0I4SAede1/+pAbmJRG44zFLPipVtdL9o3vqx9IEyb7b4/Y3s7r6ofI3CchR5GvYJ+8buCSioDv5dQLiA==", "dev": true }, "grunt-legacy-log": { @@ -2909,9 +2910,9 @@ } }, "chalk": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.1.tgz", - "integrity": "sha512-diHzdDKxcU+bAsUboHLPEDQiw0qEe0qd7SYUn3HgcFlWgbDcfLGswOHYeGrHKzG9z6UYf01d9VFMfZxPM1xZSg==", + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", "dev": true, "requires": { "ansi-styles": "^4.1.0", @@ -2965,12 +2966,6 @@ "which": "~2.0.2" }, "dependencies": { - "lodash": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", - "dev": true - }, "which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", @@ -3040,6 +3035,15 @@ "har-schema": "^2.0.0" } }, + "has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dev": true, + "requires": { + "function-bind": "^1.1.1" + } + }, "has-ansi": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-1.0.3.tgz", @@ -3104,9 +3108,9 @@ "dev": true }, "hosted-git-info": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.7.1.tgz", - "integrity": "sha512-7T/BxH19zbcCTa8XkMlbK5lTo1WtgkFi3GvdWEyNuc4Vex7/9Dqbnpsf4JMydcfj9HCg4zUWFTL3Za6lapg5/w==", + "version": "2.8.9", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz", + "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==", "dev": true }, "htmlparser2": { @@ -3409,6 +3413,15 @@ "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", "dev": true }, + "is-core-module": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.9.0.tgz", + "integrity": "sha512-+5FPy5PnwmO3lvfMb0AsoPaBG+5KHUI0wYFXOtYPnVVVspTFUuMZNfNaNVRt3FZadstu2c8x23vykRW/NBoU6A==", + "dev": true, + "requires": { + "has": "^1.0.3" + } + }, "is-data-descriptor": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", @@ -3659,9 +3672,9 @@ "dev": true }, "json-schema": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", - "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=", + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.4.0.tgz", + "integrity": "sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA==", "dev": true }, "json-schema-traverse": { @@ -3689,14 +3702,14 @@ "dev": true }, "jsprim": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", - "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.2.tgz", + "integrity": "sha512-P2bSOMAc/ciLz6DzgjVlGJP9+BrJWu5UDGK70C2iweC5QBIeFf0ZXRvGjEj2uYgrY2MkAAhsSWHDWlFtEroZWw==", "dev": true, "requires": { "assert-plus": "1.0.0", "extsprintf": "1.3.0", - "json-schema": "0.2.3", + "json-schema": "0.4.0", "verror": "1.10.0" } }, @@ -3728,41 +3741,86 @@ "type-check": "~0.3.2" } }, - "liftoff": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/liftoff/-/liftoff-2.5.0.tgz", - "integrity": "sha1-IAkpG7Mc6oYbvxCnwVooyvdcMew=", + "liftup": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/liftup/-/liftup-3.0.1.tgz", + "integrity": "sha512-yRHaiQDizWSzoXk3APcA71eOI/UuhEkNN9DiW2Tt44mhYzX4joFoCZlxsSOF7RyeLlfqzFLQI1ngFq3ggMPhOw==", "dev": true, "requires": { - "extend": "^3.0.0", - "findup-sync": "^2.0.0", - "fined": "^1.0.1", - "flagged-respawn": "^1.0.0", + "extend": "^3.0.2", + "findup-sync": "^4.0.0", + "fined": "^1.2.0", + "flagged-respawn": "^1.0.1", "is-plain-object": "^2.0.4", - "object.map": "^1.0.0", - "rechoir": "^0.6.2", - "resolve": "^1.1.7" + "object.map": "^1.0.1", + "rechoir": "^0.7.0", + "resolve": "^1.19.0" }, "dependencies": { + "braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, + "requires": { + "fill-range": "^7.0.1" + } + }, + "fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, + "requires": { + "to-regex-range": "^5.0.1" + } + }, "findup-sync": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/findup-sync/-/findup-sync-2.0.0.tgz", - "integrity": "sha1-kyaxSIwi0aYIhlCoaQGy2akKLLw=", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/findup-sync/-/findup-sync-4.0.0.tgz", + "integrity": "sha512-6jvvn/12IC4quLBL1KNokxC7wWTvYncaVUYSoxWw7YykPLuRrnv4qdHcSOywOI5RpkOVGeQRtWM8/q+G6W6qfQ==", "dev": true, "requires": { "detect-file": "^1.0.0", - "is-glob": "^3.1.0", - "micromatch": "^3.0.4", + "is-glob": "^4.0.0", + "micromatch": "^4.0.2", "resolve-dir": "^1.0.1" } }, - "is-glob": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-3.1.0.tgz", - "integrity": "sha1-e6WuJCF4BKxwcHuWkiVnSGzD6Eo=", + "is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true + }, + "micromatch": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", + "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", "dev": true, "requires": { - "is-extglob": "^2.1.0" + "braces": "^3.0.2", + "picomatch": "^2.3.1" + } + }, + "resolve": { + "version": "1.22.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.0.tgz", + "integrity": "sha512-Hhtrw0nLeSrFQ7phPp4OOcVjLPIeMnRlr5mcnVuMe7M/7eBn98A3hmFRLoFo3DLZkivSYwhRUJTyPyWAk56WLw==", + "dev": true, + "requires": { + "is-core-module": "^2.8.1", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + } + }, + "to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "requires": { + "is-number": "^7.0.0" } } } @@ -3994,18 +4052,18 @@ "dev": true }, "minimatch": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "version": "3.0.8", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.8.tgz", + "integrity": "sha512-6FsRAQsxQ61mw+qP1ZzbL9Bc78x2p5OqNgNpnoAFLTrX8n5Kxph0CsnhmKKNXTWjXqU5L0pGPR7hYk+XWZr60Q==", "dev": true, "requires": { "brace-expansion": "^1.1.7" } }, "minimist": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", - "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", "dev": true }, "minipass": { @@ -4018,15 +4076,6 @@ "yallist": "^3.0.0" } }, - "minizlib": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-1.2.1.tgz", - "integrity": "sha512-7+4oTUOWKg7AuL3vloEWekXY2/D20cevzsrNT2kGWm+39J9hGTCBv8VI5Pm5lXZ/o3/mdR4f8rflAPhnQb8mPA==", - "dev": true, - "requires": { - "minipass": "^2.2.1" - } - }, "mississippi": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/mississippi/-/mississippi-3.0.0.tgz", @@ -4067,21 +4116,10 @@ } }, "mkdirp": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", - "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", - "dev": true, - "requires": { - "minimist": "0.0.8" - }, - "dependencies": { - "minimist": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", - "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", - "dev": true - } - } + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", + "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", + "dev": true }, "move-concurrently": { "version": "1.0.1", @@ -4095,6 +4133,17 @@ "mkdirp": "^0.5.1", "rimraf": "^2.5.4", "run-queue": "^1.0.3" + }, + "dependencies": { + "mkdirp": { + "version": "0.5.6", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz", + "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==", + "dev": true, + "requires": { + "minimist": "^1.2.6" + } + } } }, "ms": { @@ -4499,6 +4548,15 @@ "once": "^1.3.0", "path-is-absolute": "^1.0.0" } + }, + "mkdirp": { + "version": "0.5.6", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz", + "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==", + "dev": true, + "requires": { + "minimist": "^1.2.6" + } } } }, @@ -4619,6 +4677,12 @@ "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=", "dev": true }, + "picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true + }, "pkg-up": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/pkg-up/-/pkg-up-3.1.0.tgz", @@ -4766,9 +4830,9 @@ "dev": true }, "qs": { - "version": "6.5.2", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", - "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==", + "version": "6.5.3", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.3.tgz", + "integrity": "sha512-qxXIEh4pCGfHICj1mAJQ2/2XVZkjCDTcEgfoSQxc/fYivUZxTkk7L3bDBJSoNrEzXI17oUO5Dp07ktqE5KzczA==", "dev": true }, "raw-body": { @@ -4816,12 +4880,12 @@ } }, "rechoir": { - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", - "integrity": "sha1-hSBLVNuoLVdC4oyWdW70OvUOM4Q=", + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.7.1.tgz", + "integrity": "sha512-/njmZ8s1wVeR6pjTZ+0nCnv8SpZNRMT2D1RLOJQESlYFDBvwpTA4KWJpZ+sBJ4+vhjILRcK7JIFdGCdxEAAitg==", "dev": true, "requires": { - "resolve": "^1.1.6" + "resolve": "^1.9.0" } }, "regex-not": { @@ -5057,9 +5121,9 @@ "dev": true }, "set-value": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.0.tgz", - "integrity": "sha512-hw0yxk9GT/Hr5yJEYnHNKYXkIA8mVJgd9ditYZCe16ZczcaELYYcfvaXesNACk2O8O0nTiPQcQhGUQj8JLzeeg==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.1.tgz", + "integrity": "sha512-JxHc1weCN68wRY0fhCoXpyK55m/XPHafOmK4UWD7m2CI14GMcFypt4w/0+NV5f/ZMby2F6S2wwA7fgynh9gWSw==", "dev": true, "requires": { "extend-shallow": "^2.0.1", @@ -5071,7 +5135,7 @@ "extend-shallow": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "integrity": "sha512-zCnTtlxNoAiDc3gqY2aYAWFx7XWWiasuF2K8Me5WbN8otHKTUKBwjPtNpRs/rbUZm7KxWAaNj7P1a/p52GbVug==", "dev": true, "requires": { "is-extendable": "^0.1.0" @@ -5507,6 +5571,12 @@ "has-flag": "^3.0.0" } }, + "supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "dev": true + }, "table": { "version": "5.4.0", "resolved": "https://registry.npmjs.org/table/-/table-5.4.0.tgz", @@ -5548,20 +5618,35 @@ } }, "tar": { - "version": "4.4.15", - "resolved": "https://registry.npmjs.org/tar/-/tar-4.4.15.tgz", - "integrity": "sha512-ItbufpujXkry7bHH9NpQyTXPbJ72iTlXgkBAYsAjDXk3Ds8t/3NfO5P4xZGy7u+sYuQUbimgzswX4uQIEeNVOA==", - "dev": true, - "requires": { - "chownr": "^1.1.1", - "fs-minipass": "^1.2.5", - "minipass": "^2.8.6", - "minizlib": "^1.2.1", - "mkdirp": "^0.5.0", - "safe-buffer": "^5.1.2", - "yallist": "^3.0.3" + "version": "4.4.19", + "resolved": "https://registry.npmjs.org/tar/-/tar-4.4.19.tgz", + "integrity": "sha512-a20gEsvHnWe0ygBY8JbxoM4w3SJdhc7ZAuxkLqh+nvNQN2IOt0B5lLgM490X5Hl8FF0dl0tOf2ewFYAlIFgzVA==", + "dev": true, + "requires": { + "chownr": "^1.1.4", + "fs-minipass": "^1.2.7", + "minipass": "^2.9.0", + "minizlib": "^1.3.3", + "mkdirp": "^0.5.5", + "safe-buffer": "^5.2.1", + "yallist": "^3.1.1" }, "dependencies": { + "chownr": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz", + "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==", + "dev": true + }, + "fs-minipass": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-1.2.7.tgz", + "integrity": "sha512-GWSSJGFy4e9GUeCcbIkED+bgAoFyj7XF1mV8rma3QW4NIqX9Kyx79N/PF61H5udOV3aY1IaMLs6pGbH71nlCTA==", + "dev": true, + "requires": { + "minipass": "^2.6.0" + } + }, "minipass": { "version": "2.9.0", "resolved": "https://registry.npmjs.org/minipass/-/minipass-2.9.0.tgz", @@ -5571,6 +5656,36 @@ "safe-buffer": "^5.1.2", "yallist": "^3.0.0" } + }, + "minizlib": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-1.3.3.tgz", + "integrity": "sha512-6ZYMOEnmVsdCeTJVE0W9ZD+pVnE8h9Hma/iOwwRDsdQoePpoX56/8B6z3P9VNwppJuBKNRuFDRNRqRWexT9G9Q==", + "dev": true, + "requires": { + "minipass": "^2.9.0" + } + }, + "mkdirp": { + "version": "0.5.6", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz", + "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==", + "dev": true, + "requires": { + "minimist": "^1.2.6" + } + }, + "safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "dev": true + }, + "yallist": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", + "dev": true } } }, @@ -5763,48 +5878,33 @@ "dev": true }, "underscore.string": { - "version": "3.3.5", - "resolved": "https://registry.npmjs.org/underscore.string/-/underscore.string-3.3.5.tgz", - "integrity": "sha512-g+dpmgn+XBneLmXXo+sGlW5xQEt4ErkS3mgeN2GFbremYeMBSJKr9Wf2KJplQVaiPY/f7FN6atosWYNm9ovrYg==", + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/underscore.string/-/underscore.string-3.3.6.tgz", + "integrity": "sha512-VoC83HWXmCrF6rgkyxS9GHv8W9Q5nhMKho+OadDJGzL2oDYbYEppBaCMH6pFlwLeqj2QS+hhkw2kpXkSdD1JxQ==", "dev": true, "requires": { - "sprintf-js": "^1.0.3", + "sprintf-js": "^1.1.1", "util-deprecate": "^1.0.2" + }, + "dependencies": { + "sprintf-js": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.2.tgz", + "integrity": "sha512-VE0SOVEHCk7Qc8ulkWw3ntAzXuqf7S2lvwQaDLRnUeIEaKNQJzV6BwmLKhOqT61aGhfUMrXeaBk+oDGCzvhcug==", + "dev": true + } } }, "union-value": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.0.tgz", - "integrity": "sha1-XHHDTLW61dzr4+oM0IIHulqhrqQ=", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.1.tgz", + "integrity": "sha512-tJfXmxMeWYnczCVs7XAEvIV7ieppALdyepWMkHkwciRpZraG/xwT+s2JN8+pr1+8jCRf80FFzvr+MpQeeoF4Xg==", "dev": true, "requires": { "arr-union": "^3.1.0", "get-value": "^2.0.6", "is-extendable": "^0.1.1", - "set-value": "^0.4.3" - }, - "dependencies": { - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "requires": { - "is-extendable": "^0.1.0" - } - }, - "set-value": { - "version": "0.4.3", - "resolved": "https://registry.npmjs.org/set-value/-/set-value-0.4.3.tgz", - "integrity": "sha1-fbCPnT0i3H945Trzw79GZuzfzPE=", - "dev": true, - "requires": { - "extend-shallow": "^2.0.1", - "is-extendable": "^0.1.1", - "is-plain-object": "^2.0.1", - "to-object-path": "^0.3.0" - } - } + "set-value": "^2.0.1" } }, "unique-filename": { @@ -5911,9 +6011,9 @@ "dev": true }, "v8flags": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/v8flags/-/v8flags-3.1.3.tgz", - "integrity": "sha512-amh9CCg3ZxkzQ48Mhcb8iX7xpAfYJgePHxWMQCBWECpOSqJUXgY26ncA61UTV0BkPqfhcy6mzwCIoP4ygxpW8w==", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/v8flags/-/v8flags-3.2.0.tgz", + "integrity": "sha512-mH8etigqMfiGWdeXpaaqGfs6BndypxusHHcv2qSHyZkGEznCd/qAXCWWRzeowtL54147cktFOC4P5y+kl8d8Jg==", "dev": true, "requires": { "homedir-polyfill": "^1.0.1" @@ -5993,6 +6093,26 @@ "dev": true, "requires": { "mkdirp": "^0.5.1" + }, + "dependencies": { + "mkdirp": { + "version": "0.5.6", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz", + "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==", + "dev": true, + "requires": { + "minimist": "^1.2.6" + } + } + } + }, + "ws": { + "version": "6.2.2", + "resolved": "https://registry.npmjs.org/ws/-/ws-6.2.2.tgz", + "integrity": "sha512-zmhltoSR8u1cnDsD43TX59mzoMZsLKqUweyYBAIvTngR3shc0W6aOZylZmq/7hqyVxPdi+5Ud2QInblgyE72fw==", + "dev": true, + "requires": { + "async-limiter": "~1.0.0" } }, "xml2js": { @@ -6028,15 +6148,6 @@ "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.0.3.tgz", "integrity": "sha512-S+Zk8DEWE6oKpV+vI3qWkaK+jSbIK86pCwe2IF/xwIpQ8jEuxpw9NyaGjmp9+BoJv5FV2piqCDcoCtStppiq2A==", "dev": true - }, - "yauzl": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.4.1.tgz", - "integrity": "sha1-lSj0QtqxsihOWLQ3m7GU4i4MQAU=", - "dev": true, - "requires": { - "fd-slicer": "~1.0.1" - } } } } diff --git a/src/core/Comment.ts b/src/core/Comment.ts index 7bbbbbae..4f9b1972 100644 --- a/src/core/Comment.ts +++ b/src/core/Comment.ts @@ -27,8 +27,7 @@ class CoreComment implements IComment { private _motionEnd:Array; private _alphaMotion:Object = null; - public _x:number; - public _y:number; + /** * Absolute coordinates. Use absolute coordinates if true otherwise use percentages. @@ -46,22 +45,23 @@ class CoreComment implements IComment { */ public axis:number = 0; - public _alpha:number = 1; - public _size:number = 25; - private _width:number; - private _height:number; - private _color:number = 0xffffff; - private _border:boolean = false; - private _shadow:boolean = true; - private _font:string = ''; - private _transform:CommentUtils.Matrix3D = null; - private _className:string = ''; + protected _x:number; + protected _y:number; + + protected _alpha:number = 1; + protected _size:number = 25; + protected _width:number; + protected _height:number; + protected _color:number = 0xffffff; + protected _border:boolean = false; + protected _shadow:boolean = true; + protected _font:string = ''; + protected _transform:CommentUtils.Matrix3D = null; + protected _className:string = ''; public parent:ICommentManager; public dom:HTMLDivElement; - public className:String; - constructor(parent:ICommentManager, init:Object = {}) { if (!parent) { throw new Error('Comment not bound to comment manager.'); @@ -184,14 +184,14 @@ class CoreComment implements IComment { } else { this.dom = document.createElement('div'); } - this.dom.className = this.parent.options.global.className; - if (this._className !== "") { - this.dom.className += " " + this._className; - } + this.dom.appendChild(document.createTextNode(this.text)); this.dom.textContent = this.text; this.dom.innerText = this.text; + this.size = this._size; + this.className = this._className; + if (this._color != 0xffffff) { this.color = this._color; } @@ -275,14 +275,14 @@ class CoreComment implements IComment { } get width():number { - if (this._width === null || this._width === undefined) { + if (typeof this._width === 'undefined' || this._width === null) { this._width = this.dom.offsetWidth; } return this._width; } get height():number { - if (this._height === null || this._height === undefined) { + if (typeof this._height === 'undefined' || this._height === null) { this._height = this.dom.offsetHeight; } return this._height; @@ -316,6 +316,10 @@ class CoreComment implements IComment { return this._transform.flatArray; } + get className():string { + return this._className; + } + set x(x:number) { this._x = x; if (!this.absolute) { @@ -367,7 +371,8 @@ class CoreComment implements IComment { set alpha(a:number) { this._alpha = a; - this.dom.style.opacity = Math.min(this._alpha, this.parent.options.global.opacity) + ''; + this.dom.style.opacity = + Math.min(this._alpha, this.parent.options.global.opacity) + ''; } set border(b:boolean) { @@ -402,6 +407,11 @@ class CoreComment implements IComment { } } + set className(className:string) { + this._className = className; + this.dom.className = this.parent.options.global.className + ' ' + className; + } + /** * Moves the comment by a number of milliseconds. When * the given parameter is greater than 0 the comment moves diff --git a/src/core/CommentUtils.ts b/src/core/CommentUtils.ts index 65b20b1b..5e6ed429 100644 --- a/src/core/CommentUtils.ts +++ b/src/core/CommentUtils.ts @@ -17,22 +17,31 @@ module CommentUtils { return new Matrix3D([xscale, 0, 0, 0, 0, yscale, 0, 0, 0, 0, zscale, 0, 0, 0, 0, 1]); }; + /** + * Create a 3d rotation matrix from degrees of rotation specified + * This uses eulerAngles as the orientation + * + * @param {number} xrot Rotate along x-axis + * @param {number} yrot Rotate along y-axis + * @param {number} zrot Rotate along z-axis + * @return {Matrix3D} Rotation matrix + */ public static createRotationMatrix:Function = function (xrot:number, yrot:number, zrot:number):Matrix3D { - // Courtesy of @StarBrilliant, re-adapted for general case - // TODO: add support for xrot - var DEG2RAD = Math.PI/180; + const COS = Math.cos; + const SIN = Math.sin; + const DEG2RAD = Math.PI/180; + + var xr = xrot * DEG2RAD; var yr = yrot * DEG2RAD; var zr = zrot * DEG2RAD; - var COS = Math.cos; - var SIN = Math.sin; + var matrix = [ - COS(yr) * COS(zr) , COS(yr) * SIN(zr) , SIN(yr) , 0, - (-SIN(zr)) , COS(zr) , 0 , 0, - (-SIN(yr) * COS(zr)) , (-SIN(yr) * SIN(zr)) , COS(yr) , 0, - 0 , 0 , 0 , 1 + COS(yr) * COS(zr) , COS(yr) * SIN(zr) , - SIN(yr) , 0, + SIN(xr) * SIN(yr) * COS(zr) - COS(xr) * SIN(zr) , SIN(xr) * SIN(yr) * SIN(zr) + COS(xr) * COS(zr) , SIN(xr) * COS(yr) , 0, + COS(xr) * SIN(yr) * COS(zr) + SIN(xr) * SIN(zr) , COS(xr) * SIN(yr) * SIN(zr) - SIN(xr) * COS(zr) , COS(xr) * COS(yr) , 0, + 0 , 0 , 0 , 1 ]; - // Do some rounding - return new Matrix3D(matrix.map(v => Math.round(v * 1e10) * 1e-10)); + return new Matrix3D(matrix); }; /** @@ -54,7 +63,7 @@ module CommentUtils { return this._internalArray.slice(0); } - set flatArray(array:Array) { + set flatArray(_array:Array) { throw new Error('Not permitted. Matrices are immutable.'); } diff --git a/src/core/css-renderer/CssComment.ts b/src/core/css-renderer/CssComment.ts index 38bd28e6..3bf96bee 100644 --- a/src/core/css-renderer/CssComment.ts +++ b/src/core/css-renderer/CssComment.ts @@ -6,18 +6,7 @@ * @description Comment abstraction based on CSS3 implementation */ /// -class CssCompatLayer { - public static transform(dom:HTMLDivElement, trans:string):void{ - dom.style.transform = trans; - dom.style["webkitTransform"] = trans; - dom.style["msTransform"] = trans; - dom.style["oTransform"] = trans; - } -} -/** - * An add-in class to support CSS-based scrolling comments - */ class CssScrollComment extends ScrollComment { // Marker for whether we need to re-create the CSS or not private _dirtyCSS:boolean = true; @@ -27,40 +16,46 @@ class CssScrollComment extends ScrollComment { this._toggleClass('css-optimize', true); } - set x(x:number) { - if (this._x !== null && typeof this._x === "number") { - // This is run when starting - var dx:number = x - this._x; - this._x = x; - CssCompatLayer.transform(this.dom, "translateX(" + - (this.axis % 2 === 0 ? dx : -dx) + "px)"); - } else { - // This is run when stopping - this._x = x; - if (!this.absolute) { - this._x *= this.parent.width; - } - // Got the x-value, now figure out where things are - if (this.axis % 2 === 0) { - // x-axis towards right - this.dom.style.left = - (this._x + (this.align % 2 === 0 ? 0 : -this.width)) + 'px'; - } else { - // x-axis towards left - this.dom.style.right = - (this._x + (this.align % 2 === 0 ? -this.width : 0)) + 'px'; - } - } + protected _calculateX():number { + var width = (typeof this._width === 'undefined') ? 0 : this.width; + var x = (this.ttl / this.dur) * (this.parent.width + width) - width; + return (!this.absolute) ? (x / this.parent.width) : x; } get x():number{ - // X always goes from {parent.width to -this.width} - return (this.ttl / this.dur) * (this.parent.width + this.width) - this.width; + return this._calculateX(); + } + + set x(x:number) { + /* + Re-pivot x to animate from the current _x location. + */ + // Convert to pixel space + if (!this.absolute) { + x *= this.parent.width; + } + var dx:number = x - this._calculateX(); + this.dom.style.transform = + "translateX(" + (this.axis % 2 === 0 ? dx : -dx) + "px)" + + (this._transform === null || this._transform.isIdentity() ? + '' : (' ' + this._transform.toCss())); + + if (this.axis % 2 === 0) { + // x-axis towards right + this.dom.style.left = this._calculateX() + 'px'; + } else { + // x-axis towards left + this.dom.style.right = this._calculateX() + 'px'; + } } public update():void{ + /* + This is called by the update manager + Since CSS updates are very different, super should not be called. + */ if (this._dirtyCSS) { - // Start moving + // Recreate the CSS this.dom.style.transition = "transform " + this.ttl + "ms linear"; this.x = - this.width; this._dirtyCSS = false; @@ -70,6 +65,14 @@ class CssScrollComment extends ScrollComment { public invalidate():void{ super.invalidate(); this._dirtyCSS = true; + + if (!this.dom) { + return; // DOM not created yet, do nothing + } else { + // Clear the transition to prepare for a rewrite + this.dom.style.transition = ''; + this.x = this.x; + } } /** @@ -77,14 +80,6 @@ class CssScrollComment extends ScrollComment { */ public stop():void{ super.stop(); - this.dom.style.transition = ''; - // This clears translation (sets translate to 0px) - this.x = this._x; - // Set to null to force writing an absolute x position - this._x = null; - // Write down the current expected x as absolute - this.x = this.x; - // Make the CSS dirty so that next update will start the movement - this._dirtyCSS = true; + this.invalidate(); } }

AltStyle によって変換されたページ (->オリジナル) /