web-document-viewer 11.5.2 → 11.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/atalaWebDocumentViewer.d.ts +1 -1
- package/atalaWebDocumentViewer.js +13 -13
- package/package.json +1 -1
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
// Permission for usage and modification of this code is only permitted
|
|
8
8
|
// with the purchase of a source code license.
|
|
9
9
|
//-------------------------------------------------------------------------------------------------
|
|
10
|
-
// Version 11,5,0,
|
|
10
|
+
// Version 11,5,0,205
|
|
11
11
|
|
|
12
12
|
export as namespace Atalasoft;
|
|
13
13
|
interface NotificationCallback {
|
|
@@ -569,7 +569,7 @@ function Dn(e){return{" transform":e,"-moz-transform":e,"-webkit-transform":e,"-
|
|
|
569
569
|
*/function Qe(e){if("string"==typeof e){var t=e.trim(),n=parseInt(t);if(/^([+|-]?[0-9]+)$/.test(t))return n}return"number"!=typeof e?null:e}
|
|
570
570
|
/**
|
|
571
571
|
* @private
|
|
572
|
-
*/function Cn(e){return isFinite(e)&&!(e%1)}function We(e){return!isNaN(e)&&isFinite(e)}var Mn={instanceCounter:0};function S(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var En=function(){function e(e){S(this,"viewer",void 0),S(this,"currentThumb",void 0),this.viewer=e,this.currentThumb=null}var t=e.prototype;return t.isViewerActive=function(){return!(!this.viewer||!this.currentThumb)},t.isThumbnailerActive=function(e){return e&&!!this.currentThumb&&this.currentThumb.get()===e.get()},t.activateThumbnailer=function(e,t,n,o,i){var a=this.isThumbnailerActive(e);a&&!i||(this.currentThumb&&!a&&this.currentThumb.detachViewer(),this.currentThumb=e,this.viewer&&this.viewer.isInitialized()&&(this.viewer.switchDocument(t,n,o),this.currentThumb.activateViewer()))},t.closeDocument=function(e,t){e=e||this.currentThumb;var n=this.isThumbnailerActive(e);n&&(e.detachViewer(),this.currentThumb=null),this.viewer&&this.viewer.isInitialized()&&t&&this.viewer.closeDocument(t,n)},e}();function I(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function F(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Sn=function(){function e(e){F(this,"jqe",pn({})),F(this,"memoryEntries",[]),F(this,"config",{colorDepth:8,compression:1,highWaterMark:5e8,pageSize:{width:800,height:1132}}),F(this,"bytesInUse",0),e&&pn.extend(this.config,e)}var t,n,o,i=e.prototype;return i.dispose=function(){this.clearEntries()},i.bind=function(){return this.jqe.on.apply(this.jqe,arguments),this},i.unbind=function(){return this.jqe.off.apply(this.jqe,arguments),this},i.trigger=function(e){return this.jqe.trigger.apply(this.jqe,arguments),this},i.allocate=function(e){return this.memoryEntries.push(e),this.bytesInUse+=this.calcBytes(e),this.bytesInUse>this.config.highWaterMark&&this.trigger("exceededhighwatermark"),this.bytesInUse},i.deallocateOldestEntry=function(){var e=this.memoryEntries.shift();return void 0!==e&&this.deallocate(e),e},i.clearEntries=function(){this.memoryEntries.length=0,this.bytesInUse=0},i.deallocate=function(e){return this.bytesInUse-=this.calcBytes(e),this.bytesInUse<0&&(this.bytesInUse=0),this.bytesInUse},i.calcBytes=function(e){return(e.width()||this.config.pageSize.width)*(e.height()||this.config.pageSize.height)*this.config.colorDepth/8*this.config.compression},t=e,(n=[{key:"typeOf",get:function(){return"Atalasoft.Document.MemoryTacker"}},{key:"colorDepth",set:function(e){this.config.colorDepth=e},get:function(){return this.config.colorDepth}},{key:"highWatermark",set:function(e){this.config.highWaterMark=e},get:function(){return this.config.highWaterMark}},{key:"pageSize",set:function(e){this.config.pageSize={width:e.width,height:e.height}},get:function(){return this.config.pageSize}}])&&I(t.prototype,n),o&&I(t,o),e}(),In=[11,5,0,190],A=(n(61),n(88),n(89),n(62),n(117),n(63),n(66),function(o,e,t){var n=this,f=o,h=e,g=null,p=null,v=!1,m={" ":!0,"-":!0,"?":!0,"\n":!0,"\t":!0},i=t,a=null;function b(){var e,t;(t=document.body).currentStyle?e=t.currentStyle.direction:window.getComputedStyle&&(e=document.defaultView.getComputedStyle(t,null).getPropertyValue("direction")),"rtl"===e.toLowerCase()&&(v=!0),g=pn("<canvas "+(v?'dir="rtl"':"")+"/>"),p=pn('<span class="atala_span">{[|,0123456789Thqkbfjplyg</span>'),pn(i).append(p)}function r(e){g&&p||b(),h.applyTo(p),g[0].width=e.width,g[0].height=e.height;var t=g[0].getContext("2d"),n=function(e,t,n){var o=[];if("string"==typeof t){if(f.text.autoscale)return t.split("\n");for(var i=t,a=n,r=function(e){for(var t=[],n="",o=0,i=0;i<e.length;i++){var a=e[i];m[n]&&(t.push(e.substr(o,i-o)),o=i),n=a}return o<e.length&&t.push(e.substr(o,e.length-o)),t}(i),l="",s="",c=[],u=0;u<r.length;u++)if(l=s,s=r[u],e.measureText(s).width>a)for(var d=s.split(""),h=0;h<d.length;h++)c.push(d[h]),e.measureText(c.join("")).width>a&&(c.pop(),o.push(c.join("")),c.length=0,c.push(d[h]));else c.push(s),(e.measureText(c.join("").trim()).width>a||0<=l.indexOf("\n"))&&(c.pop(),o.push(c.join("")),c.length=0,c.push(s));0<c.length&&(o.push(c.join("")),c.length=0)}return o}(t,f.text.value,e.width),o=function(e){if(f.text.autoscale){var t=Math.max(0,f.height-2*f.outline.width);return 0<e?Math.floor(t/e):t}return h.applyTo(p,1),p[0].offsetHeight}(n.length),i=f.text.autoscale?o:f.text.font.size,a=[f.text.font.italic?"italic":"normal",f.text.font.bold?"bold":"normal",i+"px",f.text.font.family];t.font=a.join(" "),t.fillStyle=f.text.font.color,t.textBaseline="top";var r,l=0,s=n.length?n[0]:"";for(r=0;r<n.length;r++)n[r].length>s.length&&(s=n[r]);var c=t.measureText(s).width,u=v?c:0;if(f.text.autoscale&&"left"!==f.text.align)switch(f.text.align){case"center":t.textAlign=f.text.align,u=c/2;break;case"right":t.textAlign=f.text.align,u=v?0:c;break;default:t.textAlign="start",u=v?c:0}if(f.text.autoscale){var d=e.width/c;t.scale(d,1)}if(!f.text.autoscale)switch(f.text.align){case"center":t.textAlign=f.text.align,u=e.width/2;break;case"right":t.textAlign=f.text.align,u=e.width}for(r=0;r<n.length;r++)t.fillText(n[r],u,l,c),l+=o;return g[0].toDataURL()}n.dispose=function(){h=f=n=null,g&&g.remove&&(g.remove(),g=null),p&&p.remove&&(p.remove(),p=null),i=null},n.renderToDataURL=r,n.renderToSVGImage=function(e,t){var n=a;n&&n.width===t.width&&n.height===t.height&&n.text===o.text.value&&n.align===o.text.align||(a={width:t.width,height:t.height,text:o.text.value,align:o.text.align},e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",r(t)))}}),O=(n(119),function(e,t){var n=this,o=t,i={bold:!1,italic:!1,strike:!1,underline:!1,color:"#000000",family:"Arial",size:12},a=1,r=1,l=mn.Mobile.Any()?18:8;function s(e){e&&pn.extend(i,e),c()}function c(e,t,n){(e=e||o)&&(t=void 0!==t?t:a,n||(t=d()),u(e,t))}function u(e,t){var n="none";(i.strike||i.underline)&&(n=i.strike?"line-through ":"",n+=i.underline?"underline":"");var o=i.size*(t||1);e.css({color:i.color,"font-family":i.family,"font-style":i.italic?"italic":"normal","font-weight":i.bold?"bold":"normal","font-size":o+"pt","text-decoration":n})}function d(){return a=i.size*r<l?l/i.size:r}s(e),n.dispose=function(){i=o=n=null},n.set=s,n.get=function(e){return e?i[e]:i},n.repaint=c,n.applyTo=u,n.getAdjustedZoom=d,n.getZoom=function(){return r},n.setZoom=function(e){r=e,c()}}),N=function(e,_,w,t,n){var o=this,i=e,z=t,a=_.getEventObject(),k=null,r=null,P=null,l=null,T=_.get("text"),s=T.value,D=!1,C=3,M=mn.Mobile.Any()&&!0===n?{width:200,height:200}:{width:1,height:1},c={},u={moving:h,resized:h,moved:h,rotated:h},E=function(){var e=_.get();r||(r=pn('<textarea selectable="false"/>'),pn(l.innerDom).append(r),r.css({"background-color":"transparent",border:"0px solid","overflow-x":"hidden","overflow-y":"hidden","-moz-user-select":"none","-khtml-user-select":"none","-webkit-user-select":"none","user-select":"none",resize:"none",cursor:"inherit"}),r.attr("readonly","readonly"),r.on({focus:function(){return this.blur(),!1}}),r[0].raphaelParent=!0),r.val(T.value);var t=_.get("outline").width/2,n=Math.max(Math.ceil(e.width-2*(t+C)),1),o=Math.max(Math.ceil(e.height-2*(t+C)),1);if(P&&(P.set(T.font),P.repaint(r,1,!0)),r.css({width:n+"px",height:o+"px","max-width":n+"px","max-height":o+"px",padding:C+"px","text-align":T.align}),r.attr("title",e.tooltip),l.attr({x:Math.round(t+e.x),y:Math.round(t+e.y),width:e.width,height:e.height}),0<=e.cornerradius){var i=_.getObject();pn(i[0]).attr({rx:e.cornerradius||0,ry:e.cornerradius||0})}l.transform(S().toTransformString(!0))};function d(){var e=_.get("outline").width/2,t=_.get(),n=Math.max(Math.ceil(t.width-2*(e+C)),0),o=Math.max(Math.ceil(t.height-2*(e+C)),0);if(P&&P.set(T.font),l.attr({x:Math.round(e+C+t.x),y:Math.round(e+C+t.y),width:n,height:o,title:t.tooltip}),0<=t.cornerradius){var i=_.getObject();pn(i[0]).attr({rx:t.cornerradius||0,ry:t.cornerradius||0})}l.renderer&&l.renderer.renderToSVGImage(l[0],{width:n,height:o}),l.transform(S().toTransformString(!0))}function S(){var e=vn.matrix(),t=z.getViewerTransform(_._pageindex),n=_.getTransform();return e.add(t.a,t.b,t.c,t.d,t.e,t.f),e.add(n.a,n.b,n.c,n.d,n.e,n.f),e}function h(){l&&b()}function I(e,t,n){return{x:e.x(t,n),y:e.y(t,n)}}function f(){if(null==P&&(P=new O(T.font)),l){var e=!0!==l.removed?l:null;a.unbind(e,{showeditor:g,hideeditor:v})}var t=D,n=T.autoscale;(l=n?w.atalaImage():w.html()).isHtml&&!n||(l.renderer=new A(_.get(),P,w._page),E=d),null!=k&&w._page&&(w._page.append(k),w._page.on(c)),vn.vml&&(_.getObject().node.style.overflow="hidden"),l.transform(S().toTransformString(!0)),a.bind(l,{showeditor:g,hideeditor:v}),t&&g()}function g(){w._page[0].classList.contains(zn.atala_active_thumb)||(k||function(){k=pn("<textarea/>").hide(),w._page&&(w._page.append(k),w._page.on(c)),k.on("change keydown mouseup mousemove mousedown",p),k.bind({blur:v}),_.bind({deselected:v});var e=_.getObject();if(k.css({position:"absolute","overflow-x":"auto","overflow-y":"auto","z-index":99999,border:"0px solid",padding:"0px","background-color":"transparent","text-align":T.align}),mn.Mobile.Any()){var t=_.get(),n=Q(w.canvas,w._page);k.css({left:t.x+n.left+"px",top:t.y+n.top+"px",width:t.width+"px","max-width":t.width+"px",height:t.height+"px","max-height":t.height+"px",border:e.attr("stroke")+" "+e.attr("strokewidth")+"px","background-color":e.attr("fill")})}P.setZoom(_.getZoom()),(mn.Chrome||mn.Safari)&&k.css({resize:"none"}),null!=T.value&&k.val(T.value),T.readonly&&k.prop("readonly","readonly"),P.repaint(k,_.getZoom())}(),_&&!_.get("visible")||(!k.is(":hidden")&&D||(l.hide(),k.prop("readonly",T.readonly?"readonly":""),T.value!==k.val()&&k.val(T.value),k.show(),b()),mn.Touch&&k.focus(function(){k[0].setSelectionRange(0,9999)}),k[0].focus(),s=T.value,D=!0))}function p(e){if("keydown"===e.type&&i.config.textAnnotationEditorIgnoredKeyCodes){for(var t=!1,n=i.config.textAnnotationEditorIgnoredKeyCodes.length,o=0;o<n;o++)if(i.config.textAnnotationEditorIgnoredKeyCodes[o]===e.which){t=!0;break}if(t)return}e.stopPropagation(),T.value!==k.val()&&(T.value=k.val(),_.set({text:T}))}function v(){if(k&&((k.is(":visible")||D)&&(k.hide(),l.show(),b()),0===arguments.length||1===arguments.length&&"blur"===arguments[0].type)){a.trigger("annotationtextchanged");var e=_.getClonedData(),t=pn.extend(!0,{},e);delete t.update,delete t.getPageIndex,t.text.value=s,a.trigger({type:"annotationchanged",ann:_,annobefore:t}),k[0].blur(),D=!1}}function m(){!_||_.get("visible")?D?g():l.show():l.hide(),l.backgroundColor&&l.backgroundColor(_.get("fill").color)}function F(e){e&&(w!==e||l.removed)&&(w=e,null!=r&&(r.remove(),r=null),f(),m())}function b(e){if(F(e),E(),k&&(!k.is(":hidden")||D)){var t=_.get("outline").width/2,n=_.get(),o=_.getZoom(),i=_.getBox(),a=S(),r=I(a,i.x,i.y),l=I(a,i.x+i.width,i.y+i.height),s=i.width*o,c=i.height*o,u=(r.x+l.x-s)/2,d=(r.y+l.y-c)/2,h=C*o,f=t*o,g=2*(h+f),p=Math.max(Math.ceil(s-g),M.width),v=Math.max(Math.ceil(c-g),M.height),m=Q(w.canvas,w._page),b=n.rotation+z.getPageRotation(_._pageindex),x=0!==b?"rotate("+b+"deg)":"",y={left:Math.round(u+m.left+f)+"px",top:Math.round(d+m.top+f)+"px",width:p+"px",height:v+"px","max-width":p+"px","max-height":v+"px",padding:Math.ceil(h)+"px"};pn.extend(y,Dn(x)),k.css(y)}P&&(P.set(T.font),P.setZoom(_.getZoom()),P.repaint(k,_.getZoom()))}f(),b(),_.bind(u),o.dispose=function(){k&&k.remove(),r&&r.remove(),P&&P.dispose(),l&&l.remove(),w&&w._page&&w._page.off(c),_.unbind(u),T=l=r=P=k=a=o=null},o.set=function(e){e&&pn.extend(T,e)},o.get=function(e){return e?T[e]:T},o.getFont=function(){return P},o.inEditMode=function(){return D},o.updateView=m,o.changepaper=F,o.repaint=b},V=function(){var e=this,t=pn({}),o={drawing:!1,hold:null,pinching:!1,tapped:!1,touching:!1,delta:{x:0,y:0},origin:{x:0,y:0},point:{x:0,y:0},moves:0,e:null};function i(){t.trigger.apply(t,arguments)}function a(){i({type:"interactstart"})}function r(){i({type:"interactend"})}function l(e){if(o.e=e,a(),i(e),2===e.originalEvent.touches.length&&function(e){for(var t=null,n=0;n<e.length;n++){var o=e[n].target;if(!o||!o.raphael&&!o.raphaelParent)return!1;if(null===t)t=o;else if(t!==o)return!1}return!0}(e.originalEvent.touches))u(),o.touching=!1,(n=e).stopPropagation(),n.preventDefault(),o.pinching=!0,i({type:"pinchstart",touches:n.originalEvent.touches});else if(1===e.originalEvent.touches.length){i("selectchange"),o.touching=!0;var t=J(e);o.point.x=t.x,o.point.y=t.y,o.hold=setTimeout(c,1500)}var n}function s(){o.tapped=!1}function c(){if(0<o.moves&&null!==o.e){var e=J(o.e);Math.abs(o.point.x-e.x)<5&&Math.abs(o.point.y-e.y)<5&&(o.moves=0)}0===o.moves&&o.touching&&o.e&&(o.touching=!1,i({type:"contextmenu",x:o.e.originalEvent.touches[0].pageX,y:o.e.originalEvent.touches[0].pageY}))}function u(){null!==o.hold&&(clearTimeout(o.hold),o.hold=null)}e.events={click:function(e){i(e)},dblclick:function(e){i(e);var t=J(e);i({type:"showeditor",x:t.x,y:t.y})},mousedown:function(e){return a(),i(e),i({type:"selectchange",shiftKey:e.shiftKey,ctrlKey:e.ctrlKey}),3===e.which&&i({type:"contextmenu",x:e.clientX,y:e.clientY,event:e}),!1},mousemove:function(e){i(e)},mouseout:function(e){i(e)},mouseover:function(e){i(e)},mouseup:function(e){i(e),r()}},mn.Features.Touch&&pn.extend(!0,e.events,{touchstart:l,touchmove:function(e){var t;i(o.e=e),o.pinching?((t=e).stopPropagation(),t.preventDefault(),i({type:"pinchmove",touches:t.originalEvent.touches})):o.moves++},touchend:function(e){var t,n;i(o.e=e),o.pinching?((n=e).stopPropagation(),n.preventDefault(),o.pinching=!1,i({type:"pinchend",touches:n.originalEvent.touches}),1===n.originalEvent.touches.length&&l(n)):o.touching&&(o.touching=!1,u(),o.moves=0,o.tapped?(t=e,o.e=t,i({type:"showeditor",x:o.point.x,y:o.point.y})):(o.tapped=!0,setTimeout(s,300))),r()}}),e.bind=function(){return t.on.apply(t,arguments),e},e.unbind=function(){return t.off.apply(t,arguments),e},e.trigger=i},q=function(e){var n=pn({}),t=e,o=null,a={target:null,mx:null,my:null,px:null,py:null,dx:null,dy:null};function r(e){a.px=a.mx,a.py=a.my,e.originalEvent?(a.mx=e.originalEvent.targetTouches[0].pageX,a.my=e.originalEvent.targetTouches[0].pageY):(a.mx=e.targetTouches[0].pageX,a.my=e.targetTouches[0].pageY),a.dx=a.mx-a.px,a.dy=a.my-a.py}function l(e){a.px=a.mx,a.py=a.my,a.mx=e.screenX,a.my=e.screenY,a.dx=a.mx-a.px,a.dy=a.my-a.py}function s(){n.trigger.apply(n,arguments)}function i(){s({type:"interactstart",target:t})}function c(){s({type:"interactend",target:t})}function u(e,t,n,o,i){(e||t)&&(mn.Features.Touch&&i.target!==a.target||(null===a.px&&d(0,0,i),i.touches?r(i):l(i),s({type:"dragmove",dx:a.dx,dy:a.dy,mx:a.mx,my:a.my,originalEvent:i})))}function d(e,t,n){a.target=n.target,i(),n.touches?r(n):l(n),s({type:"dragstart",mx:a.mx,my:a.my,originalEvent:n})}function h(e){mn.Features.Touch&&e.target!==a.target||(a.target=null,a.px=null,a.py=null,a.mx=null,a.my=null,s({type:"dragend",originalEvent:e}))}function f(){s("hoverin")}function g(){s("hoverout")}function p(e){s(e)}function v(e){s(e)}function m(e){a.px=null,a.py=null,s(e)}function b(e){s(e)}function x(e){s(e)}function y(e){s(e)}function _(e){s(e)}function w(e){s(e)}function z(e){s(e),1===e.which?s("mousedownleft"):3===e.which&&s("mousedownright")}function k(e){s(e)}function P(e){s(e)}function T(e){s(e)}function D(e){s(e),3===e.which&&s("rightclick")}function C(e){s(e)}function M(e){s(e)}function E(e){s(e)}(o=new V).bind({click:_,dblclick:w,mousedown:z,mousemove:k,mouseover:T,mouseout:P,mouseup:D,touchmove:C,touchstart:E,interactstart:i,interactend:c,pinchstart:p,pinchmove:v,pinchend:m,selectchange:b,contextmenu:x,showeditor:y,annoresized:M}),this.bind=function(e){var t=arguments;!e||e.constructor.prototype!==vn.el&&e.constructor.prototype!==vn.st||(e.drag(u,d,h),e.hover(f,g),"set"!==e.type?pn(e[0]).on(o.events):e.forEach(function(e){pn(e[0]).on(o.events)}),t=Array.prototype.slice.call(t,1)),0<t.length&&n.on.apply(n,t)},this.unbind=function(e){var t=arguments;!e||e.constructor.prototype!==vn.el&&e.constructor.prototype!==vn.st?null===e&&1<t.length&&(t=Array.prototype.slice.call(t,1)):(e.undrag(),e.unhover(f,g),"set"!==e.type?pn(e[0]).off(o.events):e.forEach(function(e){pn(e[0]).off(o.events)}),t=Array.prototype.slice.call(t,1)),n.off.apply(n,t)},this.trigger=s},W=function(e,t){var n=this,o=e,i=null,a=null,r=t;function l(){return r.trigger.apply(r,arguments),n}function s(e){return e.image()}function c(e){o.customurl?e.attr("src",o.customurl):l("serverrenderurlrequested",{data:o,complete:u})}function u(e){e.customurl=e}return n.dispose=function(){a=i=o=n=null},n.bind=function(){return r.on.apply(r,arguments),n},n.unbind=function(){return r.off.apply(r,arguments),n},n.trigger=l,n.construct=function(e){return i(e,o)},n.render=function(e){a(e,o)},i=o.constructor?o.constructor:s,a=o.renderer?o.renderer:c,n},U=function(e,t,n,o,i,a){var r=this,l=e,u=t,s=n,c=o,d=null,h=null,f=a,g=i,p=null,v=null,m=null,b=null,x={},y=function(){},_=function(){};function w(e){var t=J(e);if(d.paper){var n=Q(d.paper.canvas,d.paper._page);t.x-=n.left,t.y-=n.top}return t}function z(e){var t=s.getViewerTransform(g._pageindex).invert(),n=t.x(e.x,e.y);return e.y=t.y(e.x,e.y),e.x=n,e}function k(){c.trigger.apply(c,arguments)}function P(e,t,n){d=t,h=n,e.stopPropagation(),e.preventDefault();var o=z(w(e));u.visible=!0,v={x:o.x,y:o.y},u.x=Math.round(o.x),u.y=Math.round(o.y),u.width<4&&u.height<4&&(u.width=1,u.height=1),_="path"===d.type&&"custom"!==u.type?"ellipse"!==u.type?(u.points=[{x:u.x,y:u.y}],"lines"!==u.type&&"polygon"!==u.type||u.points.push({x:u.x,y:u.y}),u.x=0,u.y=0,y=C,O):(y=M,A):(y=M,F),S(),(p={events:mn.Features.Touch?{touchend:E,touchmove:D,mouseup:E,mousemove:D}:{mouseup:E,mousemove:D},src:pn(e.srcElement||e.target),main:pn(e.currentTarget)}).src.on(p.events),p.main.on({mouseup:E})}function T(){p&&(p.src.off(p.events),p.main.off({mouseup:E}))}function D(e){e.stopPropagation(),y(e),S()}function C(e){var t=z(w(e));switch(u.type){case"line":u.points[1]=t;break;case"freehand":u.points.push(t);break;case"lines":case"polygon":u.points[u.points.length-1]=t}"path"===d.type&&("ellipse"===u.type?L():H(),d._&&0===d._.dirty&&(d._.dirty=1))}function M(e){var t=z(w(e)),n=v.x,o=v.y,i=Math.max(Math.abs(t.x-v.x),1),a=Math.max(Math.abs(t.y-v.y),1);0<u.aspectratio&&(Math.abs((t.y-v.y)/(t.x-v.x))>1/u.aspectratio?i=Math.round(a/u.aspectratio):a=Math.round(i/u.aspectratio)),t.x<v.x&&(n=v.x-i),t.y<v.y&&(o=v.y-a),u.x=n,u.y=o,u.width=i,u.height=a}function E(e){e.stopPropagation();var t=!1;if("lines"===u.type||"polygon"===u.type){if(s.activepage._index!==g._pageindex)return;if(u.points.push(z(w(e))),2!==e.button)return}else u.points?u.points&&u.points.length<2&&"custom"!==u.type&&(t=!0):(u.width<4&&u.height<4&&(u.width=100,u.height=100),S());T(),p=null,k(t?"cancelled":"drawn")}function S(){_(),d&&d.transform(I()),h&&h.repaint()}function I(){var e=vn.matrix(),t=s.getViewerTransform(g._pageindex),n=g.getTransform();return e.add(t.a,t.b,t.c,t.d,t.e,t.f),e.add(n.a,n.b,n.c,n.d,n.e,n.f),e.toTransformString()}function F(){if("image"===u.type)if((!u.originalWidth||!u.originalHeight)&&1<u.width&&1<u.height&&(u.originalWidth=u.width,u.originalHeight=u.height),"Atalasoft.Controls.WebDocumentThumbnailer"!==l.typeOf&&u.noresizeonzoom){var e=vn.matrix(),t=s.getViewerTransform(g._pageindex),n=g.getTransform();e.add(t.a,t.b,t.c,t.d,t.e,t.f),e.add(n.a,n.b,n.c,n.d,n.e,n.f),u.originalWidth&&0<e.a&&u.originalHeight&&0<e.d&&(u.width=u.originalWidth/e.a,u.height=u.originalHeight/e.d),d.attr({x:u.x,y:u.y,width:u.width,height:u.height})}else d.attr({x:u.x,y:u.y,width:u.originalWidth,height:u.originalHeight});else d.attr({x:u.x,y:u.y,width:u.width,height:u.height});f&&f.render(d,u),mn.Features.VML&&d.transform(I())}function A(){L(),d._&&0===d._.dirty&&(d._.dirty=1)}function O(){H(),d._&&0===d._.dirty&&(d._.dirty=1)}r.events={drawstart:P,drawmove:D,drawend:E,dragstart:function(e){if(!s.readonly){e.originalEvent.stopPropagation(),delete(x=pn.extend(!0,{},g.getClonedData())).update,delete x.getPageIndex;var t=g.getBox();v={x:t.x,y:t.y}}},dragmove:function(e){if(!s.readonly){e.originalEvent.stopPropagation();var t=z({x:0,y:0}),n=z({x:e.dx,y:e.dy});g.translate(n.x-t.x,n.y-t.y),k("moving")}},dragend:function(e){if(!s.readonly){e.originalEvent.stopPropagation();var t,n,o=g.getBox();if(d.paper&&d.paper._page){var i=d.getBBox(),a={x:0,y:0,width:d.paper._page.width(),height:d.paper._page.height()};if(!(j(t=a,(n=i).x,n.y)||j(t,n.x+n.width,n.y)||j(t,n.x,n.y+n.height)||j(t,n.x+n.width,n.y+n.height)))return void g.translate(v.x-o.x,v.y-o.y)}v.x===o.x&&v.y===o.y||(k("moved"),k({type:"annotationchanged",ann:g,annobefore:x}))}},update:function(){S()},viewchanged:function(e){d=e.annview,h=e.textview,_="path"===d.type&&"custom"!==u.type?"ellipse"!==u.type?(y=C,O):(y=M,A):(y=M,F)},pinchstart:function(e){if(!u.points&&!s.readonly){var t=z({x:e.touches[0].clientX,y:e.touches[0].clientY}),n=z({x:e.touches[1].clientX,y:e.touches[1].clientY}),o=g.getBox();b={start:Y(t.x,t.y,n.x,n.y),rect:o}}},pinchmove:function(e){if(b){var t=z({x:e.touches[0].clientX,y:e.touches[0].clientY}),n=z({x:e.touches[1].clientX,y:e.touches[1].clientY}),o=Y(t.x,t.y,n.x,n.y,b.start),i=o.x-b.start.x,a=o.y-b.start.y,r=b.rect.x-o.dx,l=b.rect.y-o.dy,s=b.rect.width+i,c=b.rect.height+a;u.points?g.transform(r,l,s,c):(u.x=r,u.y=l,u.width=s,u.height=c),d.paper&&d.paper._page&&d.paper._page._grips&&d.paper._page._grips.repaint(),S()}},pinchend:function(){k("resized"),k("annoresized"),b=null}},r.drawStart=P,r.unbindEvents=T,r.repaint=S,r.getTransform=I;var V=.5522847498307936;function L(){var e=u.width/2,t=u.height/2,n=V*e,o=V*t,i=u.x+u.width/2,a=u.y+u.height/2,r=["M",i,a-t,"C",i+n,a-t,i+e,a-o,i+e,a,"C",i+e,a+o,i+n,a+t,i,a+t,"C",i-n,a+t,i-e,a+o,i-e,a,"C",i-e,a-o,i-n,a-t,i,a-t,"Z"];d.attr({path:r})}function H(){if(u.points&&0!==u.points.length){for(var e=["M",u.points[0].x,u.points[0].y],t=1;t<u.points.length;t++)e=e.concat(["L",u.points[t].x,u.points[t].y]);"polygon"===u.type&&e.push("Z"),d.attr({path:e}),
|
|
572
|
+
*/function Cn(e){return isFinite(e)&&!(e%1)}function We(e){return!isNaN(e)&&isFinite(e)}var Mn={instanceCounter:0};function S(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var En=function(){function e(e){S(this,"viewer",void 0),S(this,"currentThumb",void 0),this.viewer=e,this.currentThumb=null}var t=e.prototype;return t.isViewerActive=function(){return!(!this.viewer||!this.currentThumb)},t.isThumbnailerActive=function(e){return e&&!!this.currentThumb&&this.currentThumb.get()===e.get()},t.activateThumbnailer=function(e,t,n,o,i){var a=this.isThumbnailerActive(e);a&&!i||(this.currentThumb&&!a&&this.currentThumb.detachViewer(),this.currentThumb=e,this.viewer&&this.viewer.isInitialized()&&(this.viewer.switchDocument(t,n,o),this.currentThumb.activateViewer()))},t.closeDocument=function(e,t){e=e||this.currentThumb;var n=this.isThumbnailerActive(e);n&&(e.detachViewer(),this.currentThumb=null),this.viewer&&this.viewer.isInitialized()&&t&&this.viewer.closeDocument(t,n)},e}();function I(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function F(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Sn=function(){function e(e){F(this,"jqe",pn({})),F(this,"memoryEntries",[]),F(this,"config",{colorDepth:8,compression:1,highWaterMark:5e8,pageSize:{width:800,height:1132}}),F(this,"bytesInUse",0),e&&pn.extend(this.config,e)}var t,n,o,i=e.prototype;return i.dispose=function(){this.clearEntries()},i.bind=function(){return this.jqe.on.apply(this.jqe,arguments),this},i.unbind=function(){return this.jqe.off.apply(this.jqe,arguments),this},i.trigger=function(e){return this.jqe.trigger.apply(this.jqe,arguments),this},i.allocate=function(e){return this.memoryEntries.push(e),this.bytesInUse+=this.calcBytes(e),this.bytesInUse>this.config.highWaterMark&&this.trigger("exceededhighwatermark"),this.bytesInUse},i.deallocateOldestEntry=function(){var e=this.memoryEntries.shift();return void 0!==e&&this.deallocate(e),e},i.clearEntries=function(){this.memoryEntries.length=0,this.bytesInUse=0},i.deallocate=function(e){return this.bytesInUse-=this.calcBytes(e),this.bytesInUse<0&&(this.bytesInUse=0),this.bytesInUse},i.calcBytes=function(e){return(e.width()||this.config.pageSize.width)*(e.height()||this.config.pageSize.height)*this.config.colorDepth/8*this.config.compression},t=e,(n=[{key:"typeOf",get:function(){return"Atalasoft.Document.MemoryTacker"}},{key:"colorDepth",set:function(e){this.config.colorDepth=e},get:function(){return this.config.colorDepth}},{key:"highWatermark",set:function(e){this.config.highWaterMark=e},get:function(){return this.config.highWaterMark}},{key:"pageSize",set:function(e){this.config.pageSize={width:e.width,height:e.height}},get:function(){return this.config.pageSize}}])&&I(t.prototype,n),o&&I(t,o),e}(),In=[11,5,0,205],A=(n(61),n(88),n(89),n(62),n(117),n(63),n(66),function(o,e,t){var n=this,f=o,h=e,g=null,p=null,v=!1,m={" ":!0,"-":!0,"?":!0,"\n":!0,"\t":!0},i=t,a=null;function b(){var e,t;(t=document.body).currentStyle?e=t.currentStyle.direction:window.getComputedStyle&&(e=document.defaultView.getComputedStyle(t,null).getPropertyValue("direction")),"rtl"===e.toLowerCase()&&(v=!0),g=pn("<canvas "+(v?'dir="rtl"':"")+"/>"),p=pn('<span class="atala_span">{[|,0123456789Thqkbfjplyg</span>'),pn(i).append(p)}function r(e){g&&p||b(),h.applyTo(p),g[0].width=e.width,g[0].height=e.height;var t=g[0].getContext("2d"),n=function(e,t,n){var o=[];if("string"==typeof t){if(f.text.autoscale)return t.split("\n");for(var i=t,a=n,r=function(e){for(var t=[],n="",o=0,i=0;i<e.length;i++){var a=e[i];m[n]&&(t.push(e.substr(o,i-o)),o=i),n=a}return o<e.length&&t.push(e.substr(o,e.length-o)),t}(i),l="",s="",c=[],u=0;u<r.length;u++)if(l=s,s=r[u],e.measureText(s).width>a)for(var d=s.split(""),h=0;h<d.length;h++)c.push(d[h]),e.measureText(c.join("")).width>a&&(c.pop(),o.push(c.join("")),c.length=0,c.push(d[h]));else c.push(s),(e.measureText(c.join("").trim()).width>a||0<=l.indexOf("\n"))&&(c.pop(),o.push(c.join("")),c.length=0,c.push(s));0<c.length&&(o.push(c.join("")),c.length=0)}return o}(t,f.text.value,e.width),o=function(e){if(f.text.autoscale){var t=Math.max(0,f.height-2*f.outline.width);return 0<e?Math.floor(t/e):t}return h.applyTo(p,1),p[0].offsetHeight}(n.length),i=f.text.autoscale?o:f.text.font.size,a=[f.text.font.italic?"italic":"normal",f.text.font.bold?"bold":"normal",i+"px",f.text.font.family];t.font=a.join(" "),t.fillStyle=f.text.font.color,t.textBaseline="top";var r,l=0,s=n.length?n[0]:"";for(r=0;r<n.length;r++)n[r].length>s.length&&(s=n[r]);var c=t.measureText(s).width,u=v?c:0;if(f.text.autoscale&&"left"!==f.text.align)switch(f.text.align){case"center":t.textAlign=f.text.align,u=c/2;break;case"right":t.textAlign=f.text.align,u=v?0:c;break;default:t.textAlign="start",u=v?c:0}if(f.text.autoscale){var d=e.width/c;t.scale(d,1)}if(!f.text.autoscale)switch(f.text.align){case"center":t.textAlign=f.text.align,u=e.width/2;break;case"right":t.textAlign=f.text.align,u=e.width}for(r=0;r<n.length;r++)t.fillText(n[r],u,l,c),l+=o;return g[0].toDataURL()}n.dispose=function(){h=f=n=null,g&&g.remove&&(g.remove(),g=null),p&&p.remove&&(p.remove(),p=null),i=null},n.renderToDataURL=r,n.renderToSVGImage=function(e,t){var n=a;n&&n.width===t.width&&n.height===t.height&&n.text===o.text.value&&n.align===o.text.align||(a={width:t.width,height:t.height,text:o.text.value,align:o.text.align},e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",r(t)))}}),O=(n(119),function(e,t){var n=this,o=t,i={bold:!1,italic:!1,strike:!1,underline:!1,color:"#000000",family:"Arial",size:12},a=1,r=1,l=mn.Mobile.Any()?18:8;function s(e){e&&pn.extend(i,e),c()}function c(e,t,n){(e=e||o)&&(t=void 0!==t?t:a,n||(t=d()),u(e,t))}function u(e,t){var n="none";(i.strike||i.underline)&&(n=i.strike?"line-through ":"",n+=i.underline?"underline":"");var o=i.size*(t||1);e.css({color:i.color,"font-family":i.family,"font-style":i.italic?"italic":"normal","font-weight":i.bold?"bold":"normal","font-size":o+"pt","text-decoration":n})}function d(){return a=i.size*r<l?l/i.size:r}s(e),n.dispose=function(){i=o=n=null},n.set=s,n.get=function(e){return e?i[e]:i},n.repaint=c,n.applyTo=u,n.getAdjustedZoom=d,n.getZoom=function(){return r},n.setZoom=function(e){r=e,c()}}),N=function(e,_,w,t,n){var o=this,i=e,z=t,a=_.getEventObject(),k=null,r=null,P=null,l=null,T=_.get("text"),s=T.value,D=!1,C=3,M=mn.Mobile.Any()&&!0===n?{width:200,height:200}:{width:1,height:1},c={},u={moving:h,resized:h,moved:h,rotated:h},E=function(){var e=_.get();r||(r=pn('<textarea selectable="false"/>'),pn(l.innerDom).append(r),r.css({"background-color":"transparent",border:"0px solid","overflow-x":"hidden","overflow-y":"hidden","-moz-user-select":"none","-khtml-user-select":"none","-webkit-user-select":"none","user-select":"none",resize:"none",cursor:"inherit"}),r.attr("readonly","readonly"),r.on({focus:function(){return this.blur(),!1}}),r[0].raphaelParent=!0),r.val(T.value);var t=_.get("outline").width/2,n=Math.max(Math.ceil(e.width-2*(t+C)),1),o=Math.max(Math.ceil(e.height-2*(t+C)),1);if(P&&(P.set(T.font),P.repaint(r,1,!0)),r.css({width:n+"px",height:o+"px","max-width":n+"px","max-height":o+"px",padding:C+"px","text-align":T.align}),r.attr("title",e.tooltip),l.attr({x:Math.round(t+e.x),y:Math.round(t+e.y),width:e.width,height:e.height}),0<=e.cornerradius){var i=_.getObject();pn(i[0]).attr({rx:e.cornerradius||0,ry:e.cornerradius||0})}l.transform(S().toTransformString(!0))};function d(){var e=_.get("outline").width/2,t=_.get(),n=Math.max(Math.ceil(t.width-2*(e+C)),0),o=Math.max(Math.ceil(t.height-2*(e+C)),0);if(P&&P.set(T.font),l.attr({x:Math.round(e+C+t.x),y:Math.round(e+C+t.y),width:n,height:o,title:t.tooltip}),0<=t.cornerradius){var i=_.getObject();pn(i[0]).attr({rx:t.cornerradius||0,ry:t.cornerradius||0})}l.renderer&&l.renderer.renderToSVGImage(l[0],{width:n,height:o}),l.transform(S().toTransformString(!0))}function S(){var e=vn.matrix(),t=z.getViewerTransform(_._pageindex),n=_.getTransform();return e.add(t.a,t.b,t.c,t.d,t.e,t.f),e.add(n.a,n.b,n.c,n.d,n.e,n.f),e}function h(){l&&b()}function I(e,t,n){return{x:e.x(t,n),y:e.y(t,n)}}function f(){if(null==P&&(P=new O(T.font)),l){var e=!0!==l.removed?l:null;a.unbind(e,{showeditor:g,hideeditor:v})}var t=D,n=T.autoscale;(l=n?w.atalaImage():w.html()).isHtml&&!n||(l.renderer=new A(_.get(),P,w._page),E=d),null!=k&&w._page&&(w._page.append(k),w._page.on(c)),vn.vml&&(_.getObject().node.style.overflow="hidden"),l.transform(S().toTransformString(!0)),a.bind(l,{showeditor:g,hideeditor:v}),t&&g()}function g(){w._page[0].classList.contains(zn.atala_active_thumb)||(k||function(){k=pn("<textarea/>").hide(),w._page&&(w._page.append(k),w._page.on(c)),k.on("change keydown mouseup mousemove mousedown",p),k.bind({blur:v}),_.bind({deselected:v});var e=_.getObject();if(k.css({position:"absolute","overflow-x":"auto","overflow-y":"auto","z-index":99999,border:"0px solid",padding:"0px","background-color":"transparent","text-align":T.align}),mn.Mobile.Any()){var t=_.get(),n=Q(w.canvas,w._page);k.css({left:t.x+n.left+"px",top:t.y+n.top+"px",width:t.width+"px","max-width":t.width+"px",height:t.height+"px","max-height":t.height+"px",border:e.attr("stroke")+" "+e.attr("strokewidth")+"px","background-color":e.attr("fill")})}P.setZoom(_.getZoom()),(mn.Chrome||mn.Safari)&&k.css({resize:"none"}),null!=T.value&&k.val(T.value),T.readonly&&k.prop("readonly","readonly"),P.repaint(k,_.getZoom())}(),_&&!_.get("visible")||(!k.is(":hidden")&&D||(l.hide(),k.prop("readonly",T.readonly?"readonly":""),T.value!==k.val()&&k.val(T.value),k.show(),b()),mn.Touch&&k.focus(function(){k[0].setSelectionRange(0,9999)}),k[0].focus(),s=T.value,D=!0))}function p(e){if("keydown"===e.type&&i.config.textAnnotationEditorIgnoredKeyCodes){for(var t=!1,n=i.config.textAnnotationEditorIgnoredKeyCodes.length,o=0;o<n;o++)if(i.config.textAnnotationEditorIgnoredKeyCodes[o]===e.which){t=!0;break}if(t)return}e.stopPropagation(),T.value!==k.val()&&(T.value=k.val(),_.set({text:T}))}function v(){if(k&&((k.is(":visible")||D)&&(k.hide(),l.show(),b()),0===arguments.length||1===arguments.length&&"blur"===arguments[0].type)){a.trigger("annotationtextchanged");var e=_.getClonedData(),t=pn.extend(!0,{},e);delete t.update,delete t.getPageIndex,t.text.value=s,a.trigger({type:"annotationchanged",ann:_,annobefore:t}),k[0].blur(),D=!1}}function m(){!_||_.get("visible")?D?g():l.show():l.hide(),l.backgroundColor&&l.backgroundColor(_.get("fill").color)}function F(e){e&&(w!==e||l.removed)&&(w=e,null!=r&&(r.remove(),r=null),f(),m())}function b(e){if(F(e),E(),k&&(!k.is(":hidden")||D)){var t=_.get("outline").width/2,n=_.get(),o=_.getZoom(),i=_.getBox(),a=S(),r=I(a,i.x,i.y),l=I(a,i.x+i.width,i.y+i.height),s=i.width*o,c=i.height*o,u=(r.x+l.x-s)/2,d=(r.y+l.y-c)/2,h=C*o,f=t*o,g=2*(h+f),p=Math.max(Math.ceil(s-g),M.width),v=Math.max(Math.ceil(c-g),M.height),m=Q(w.canvas,w._page),b=n.rotation+z.getPageRotation(_._pageindex),x=0!==b?"rotate("+b+"deg)":"",y={left:Math.round(u+m.left+f)+"px",top:Math.round(d+m.top+f)+"px",width:p+"px",height:v+"px","max-width":p+"px","max-height":v+"px",padding:Math.ceil(h)+"px"};pn.extend(y,Dn(x)),k.css(y)}P&&(P.set(T.font),P.setZoom(_.getZoom()),P.repaint(k,_.getZoom()))}f(),b(),_.bind(u),o.dispose=function(){k&&k.remove(),r&&r.remove(),P&&P.dispose(),l&&l.remove(),w&&w._page&&w._page.off(c),_.unbind(u),T=l=r=P=k=a=o=null},o.set=function(e){e&&pn.extend(T,e)},o.get=function(e){return e?T[e]:T},o.getFont=function(){return P},o.inEditMode=function(){return D},o.updateView=m,o.changepaper=F,o.repaint=b},V=function(){var e=this,t=pn({}),o={drawing:!1,hold:null,pinching:!1,tapped:!1,touching:!1,delta:{x:0,y:0},origin:{x:0,y:0},point:{x:0,y:0},moves:0,e:null};function i(){t.trigger.apply(t,arguments)}function a(){i({type:"interactstart"})}function r(){i({type:"interactend"})}function l(e){if(o.e=e,a(),i(e),2===e.originalEvent.touches.length&&function(e){for(var t=null,n=0;n<e.length;n++){var o=e[n].target;if(!o||!o.raphael&&!o.raphaelParent)return!1;if(null===t)t=o;else if(t!==o)return!1}return!0}(e.originalEvent.touches))u(),o.touching=!1,(n=e).stopPropagation(),n.preventDefault(),o.pinching=!0,i({type:"pinchstart",touches:n.originalEvent.touches});else if(1===e.originalEvent.touches.length){i("selectchange"),o.touching=!0;var t=J(e);o.point.x=t.x,o.point.y=t.y,o.hold=setTimeout(c,1500)}var n}function s(){o.tapped=!1}function c(){if(0<o.moves&&null!==o.e){var e=J(o.e);Math.abs(o.point.x-e.x)<5&&Math.abs(o.point.y-e.y)<5&&(o.moves=0)}0===o.moves&&o.touching&&o.e&&(o.touching=!1,i({type:"contextmenu",x:o.e.originalEvent.touches[0].pageX,y:o.e.originalEvent.touches[0].pageY}))}function u(){null!==o.hold&&(clearTimeout(o.hold),o.hold=null)}e.events={click:function(e){i(e)},dblclick:function(e){i(e);var t=J(e);i({type:"showeditor",x:t.x,y:t.y})},mousedown:function(e){return a(),i(e),i({type:"selectchange",shiftKey:e.shiftKey,ctrlKey:e.ctrlKey}),3===e.which&&i({type:"contextmenu",x:e.clientX,y:e.clientY,event:e}),!1},mousemove:function(e){i(e)},mouseout:function(e){i(e)},mouseover:function(e){i(e)},mouseup:function(e){i(e),r()}},mn.Features.Touch&&pn.extend(!0,e.events,{touchstart:l,touchmove:function(e){var t;i(o.e=e),o.pinching?((t=e).stopPropagation(),t.preventDefault(),i({type:"pinchmove",touches:t.originalEvent.touches})):o.moves++},touchend:function(e){var t,n;i(o.e=e),o.pinching?((n=e).stopPropagation(),n.preventDefault(),o.pinching=!1,i({type:"pinchend",touches:n.originalEvent.touches}),1===n.originalEvent.touches.length&&l(n)):o.touching&&(o.touching=!1,u(),o.moves=0,o.tapped?(t=e,o.e=t,i({type:"showeditor",x:o.point.x,y:o.point.y})):(o.tapped=!0,setTimeout(s,300))),r()}}),e.bind=function(){return t.on.apply(t,arguments),e},e.unbind=function(){return t.off.apply(t,arguments),e},e.trigger=i},q=function(e){var n=pn({}),t=e,o=null,a={target:null,mx:null,my:null,px:null,py:null,dx:null,dy:null};function r(e){a.px=a.mx,a.py=a.my,e.originalEvent?(a.mx=e.originalEvent.targetTouches[0].pageX,a.my=e.originalEvent.targetTouches[0].pageY):(a.mx=e.targetTouches[0].pageX,a.my=e.targetTouches[0].pageY),a.dx=a.mx-a.px,a.dy=a.my-a.py}function l(e){a.px=a.mx,a.py=a.my,a.mx=e.screenX,a.my=e.screenY,a.dx=a.mx-a.px,a.dy=a.my-a.py}function s(){n.trigger.apply(n,arguments)}function i(){s({type:"interactstart",target:t})}function c(){s({type:"interactend",target:t})}function u(e,t,n,o,i){(e||t)&&(mn.Features.Touch&&i.target!==a.target||(null===a.px&&d(0,0,i),i.touches?r(i):l(i),s({type:"dragmove",dx:a.dx,dy:a.dy,mx:a.mx,my:a.my,originalEvent:i})))}function d(e,t,n){a.target=n.target,i(),n.touches?r(n):l(n),s({type:"dragstart",mx:a.mx,my:a.my,originalEvent:n})}function h(e){mn.Features.Touch&&e.target!==a.target||(a.target=null,a.px=null,a.py=null,a.mx=null,a.my=null,s({type:"dragend",originalEvent:e}))}function f(){s("hoverin")}function g(){s("hoverout")}function p(e){s(e)}function v(e){s(e)}function m(e){a.px=null,a.py=null,s(e)}function b(e){s(e)}function x(e){s(e)}function y(e){s(e)}function _(e){s(e)}function w(e){s(e)}function z(e){s(e),1===e.which?s("mousedownleft"):3===e.which&&s("mousedownright")}function k(e){s(e)}function P(e){s(e)}function T(e){s(e)}function D(e){s(e),3===e.which&&s("rightclick")}function C(e){s(e)}function M(e){s(e)}function E(e){s(e)}(o=new V).bind({click:_,dblclick:w,mousedown:z,mousemove:k,mouseover:T,mouseout:P,mouseup:D,touchmove:C,touchstart:E,interactstart:i,interactend:c,pinchstart:p,pinchmove:v,pinchend:m,selectchange:b,contextmenu:x,showeditor:y,annoresized:M}),this.bind=function(e){var t=arguments;!e||e.constructor.prototype!==vn.el&&e.constructor.prototype!==vn.st||(e.drag(u,d,h),e.hover(f,g),"set"!==e.type?pn(e[0]).on(o.events):e.forEach(function(e){pn(e[0]).on(o.events)}),t=Array.prototype.slice.call(t,1)),0<t.length&&n.on.apply(n,t)},this.unbind=function(e){var t=arguments;!e||e.constructor.prototype!==vn.el&&e.constructor.prototype!==vn.st?null===e&&1<t.length&&(t=Array.prototype.slice.call(t,1)):(e.undrag(),e.unhover(f,g),"set"!==e.type?pn(e[0]).off(o.events):e.forEach(function(e){pn(e[0]).off(o.events)}),t=Array.prototype.slice.call(t,1)),n.off.apply(n,t)},this.trigger=s},W=function(e,t){var n=this,o=e,i=null,a=null,r=t;function l(){return r.trigger.apply(r,arguments),n}function s(e){return e.image()}function c(e){o.customurl?e.attr("src",o.customurl):l("serverrenderurlrequested",{data:o,complete:u})}function u(e){e.customurl=e}return n.dispose=function(){a=i=o=n=null},n.bind=function(){return r.on.apply(r,arguments),n},n.unbind=function(){return r.off.apply(r,arguments),n},n.trigger=l,n.construct=function(e){return i(e,o)},n.render=function(e){a(e,o)},i=o.constructor?o.constructor:s,a=o.renderer?o.renderer:c,n},U=function(e,t,n,o,i,a){var r=this,l=e,u=t,s=n,c=o,d=null,h=null,f=a,g=i,p=null,v=null,m=null,b=null,x={},y=function(){},_=function(){};function w(e){var t=J(e);if(d.paper){var n=Q(d.paper.canvas,d.paper._page);t.x-=n.left,t.y-=n.top}return t}function z(e){var t=s.getViewerTransform(g._pageindex).invert(),n=t.x(e.x,e.y);return e.y=t.y(e.x,e.y),e.x=n,e}function k(){c.trigger.apply(c,arguments)}function P(e,t,n){d=t,h=n,e.stopPropagation(),e.preventDefault();var o=z(w(e));u.visible=!0,v={x:o.x,y:o.y},u.x=Math.round(o.x),u.y=Math.round(o.y),u.width<4&&u.height<4&&(u.width=1,u.height=1),_="path"===d.type&&"custom"!==u.type?"ellipse"!==u.type?(u.points=[{x:u.x,y:u.y}],"lines"!==u.type&&"polygon"!==u.type||u.points.push({x:u.x,y:u.y}),u.x=0,u.y=0,y=C,O):(y=M,A):(y=M,F),S(),(p={events:mn.Features.Touch?{touchend:E,touchmove:D,mouseup:E,mousemove:D}:{mouseup:E,mousemove:D},src:pn(e.srcElement||e.target),main:pn(e.currentTarget)}).src.on(p.events),p.main.on({mouseup:E})}function T(){p&&(p.src.off(p.events),p.main.off({mouseup:E}))}function D(e){e.stopPropagation(),y(e),S()}function C(e){var t=z(w(e));switch(u.type){case"line":u.points[1]=t;break;case"freehand":u.points.push(t);break;case"lines":case"polygon":u.points[u.points.length-1]=t}"path"===d.type&&("ellipse"===u.type?L():H(),d._&&0===d._.dirty&&(d._.dirty=1))}function M(e){var t=z(w(e)),n=v.x,o=v.y,i=Math.max(Math.abs(t.x-v.x),1),a=Math.max(Math.abs(t.y-v.y),1);0<u.aspectratio&&(Math.abs((t.y-v.y)/(t.x-v.x))>1/u.aspectratio?i=Math.round(a/u.aspectratio):a=Math.round(i/u.aspectratio)),t.x<v.x&&(n=v.x-i),t.y<v.y&&(o=v.y-a),u.x=n,u.y=o,u.width=i,u.height=a}function E(e){e.stopPropagation();var t=!1;if("lines"===u.type||"polygon"===u.type){if(s.activepage._index!==g._pageindex)return;if(u.points.push(z(w(e))),2!==e.button)return}else u.points?u.points&&u.points.length<2&&"custom"!==u.type&&(t=!0):(u.width<4&&u.height<4&&(u.width=100,u.height=100),S());T(),p=null,k(t?"cancelled":"drawn")}function S(){_(),d&&d.transform(I()),h&&h.repaint()}function I(){var e=vn.matrix(),t=s.getViewerTransform(g._pageindex),n=g.getTransform();return e.add(t.a,t.b,t.c,t.d,t.e,t.f),e.add(n.a,n.b,n.c,n.d,n.e,n.f),e.toTransformString()}function F(){if("image"===u.type)if((!u.originalWidth||!u.originalHeight)&&1<u.width&&1<u.height&&(u.originalWidth=u.width,u.originalHeight=u.height),"Atalasoft.Controls.WebDocumentThumbnailer"!==l.typeOf&&u.noresizeonzoom){var e=vn.matrix(),t=s.getViewerTransform(g._pageindex),n=g.getTransform();e.add(t.a,t.b,t.c,t.d,t.e,t.f),e.add(n.a,n.b,n.c,n.d,n.e,n.f),u.originalWidth&&0<e.a&&u.originalHeight&&0<e.d&&(u.width=u.originalWidth/e.a,u.height=u.originalHeight/e.d),d.attr({x:u.x,y:u.y,width:u.width,height:u.height})}else d.attr({x:u.x,y:u.y,width:u.originalWidth,height:u.originalHeight});else d.attr({x:u.x,y:u.y,width:u.width,height:u.height});f&&f.render(d,u),mn.Features.VML&&d.transform(I())}function A(){L(),d._&&0===d._.dirty&&(d._.dirty=1)}function O(){H(),d._&&0===d._.dirty&&(d._.dirty=1)}r.events={drawstart:P,drawmove:D,drawend:E,dragstart:function(e){if(!s.readonly){e.originalEvent.stopPropagation(),delete(x=pn.extend(!0,{},g.getClonedData())).update,delete x.getPageIndex;var t=g.getBox();v={x:t.x,y:t.y}}},dragmove:function(e){if(!s.readonly){e.originalEvent.stopPropagation();var t=z({x:0,y:0}),n=z({x:e.dx,y:e.dy});g.translate(n.x-t.x,n.y-t.y),k("moving")}},dragend:function(e){if(!s.readonly){e.originalEvent.stopPropagation();var t,n,o=g.getBox();if(d.paper&&d.paper._page){var i=d.getBBox(),a={x:0,y:0,width:d.paper._page.width(),height:d.paper._page.height()};if(!(j(t=a,(n=i).x,n.y)||j(t,n.x+n.width,n.y)||j(t,n.x,n.y+n.height)||j(t,n.x+n.width,n.y+n.height)))return void g.translate(v.x-o.x,v.y-o.y)}v.x===o.x&&v.y===o.y||(k("moved"),k({type:"annotationchanged",ann:g,annobefore:x}))}},update:function(){S()},viewchanged:function(e){d=e.annview,h=e.textview,_="path"===d.type&&"custom"!==u.type?"ellipse"!==u.type?(y=C,O):(y=M,A):(y=M,F)},pinchstart:function(e){if(!u.points&&!s.readonly){var t=z({x:e.touches[0].clientX,y:e.touches[0].clientY}),n=z({x:e.touches[1].clientX,y:e.touches[1].clientY}),o=g.getBox();b={start:Y(t.x,t.y,n.x,n.y),rect:o}}},pinchmove:function(e){if(b){var t=z({x:e.touches[0].clientX,y:e.touches[0].clientY}),n=z({x:e.touches[1].clientX,y:e.touches[1].clientY}),o=Y(t.x,t.y,n.x,n.y,b.start),i=o.x-b.start.x,a=o.y-b.start.y,r=b.rect.x-o.dx,l=b.rect.y-o.dy,s=b.rect.width+i,c=b.rect.height+a;u.points?g.transform(r,l,s,c):(u.x=r,u.y=l,u.width=s,u.height=c),d.paper&&d.paper._page&&d.paper._page._grips&&d.paper._page._grips.repaint(),S()}},pinchend:function(){k("resized"),k("annoresized"),b=null}},r.drawStart=P,r.unbindEvents=T,r.repaint=S,r.getTransform=I;var V=.5522847498307936;function L(){var e=u.width/2,t=u.height/2,n=V*e,o=V*t,i=u.x+u.width/2,a=u.y+u.height/2,r=["M",i,a-t,"C",i+n,a-t,i+e,a-o,i+e,a,"C",i+e,a+o,i+n,a+t,i,a+t,"C",i-n,a+t,i-e,a+o,i-e,a,"C",i-e,a-o,i-n,a-t,i,a-t,"Z"];d.attr({path:r})}function H(){if(u.points&&0!==u.points.length){for(var e=["M",u.points[0].x,u.points[0].y],t=1;t<u.points.length;t++)e=e.concat(["L",u.points[t].x,u.points[t].y]);"polygon"===u.type&&e.push("Z"),d.attr({path:e}),
|
|
573
573
|
/**
|
|
574
574
|
* Work around outlined by this post:
|
|
575
575
|
* http://stackoverflow.com/questions/15693178/svg-line-markers-not-updating-when-line-moves-in-ie10
|
|
@@ -759,7 +759,7 @@ function(){return c(i)},o.getSelected=function(){return c(u)},o.selectAll=functi
|
|
|
759
759
|
* @inner
|
|
760
760
|
* @name AnnotationController
|
|
761
761
|
* @memberOf Atalasoft.Controls.WebDocumentViewer
|
|
762
|
-
*/var An=function e(t,n,o){var i=this,a=this,
|
|
762
|
+
*/var An=function e(t,n,o){var i=this,a=this,h=t,x=n,c=new Ve(h),r={
|
|
763
763
|
/** @lends Atalasoft.Controls.WebDocumentViewer~AnnotationController */
|
|
764
764
|
annotations:{events:{
|
|
765
765
|
/**
|
|
@@ -1200,7 +1200,7 @@ setStamps:$,
|
|
|
1200
1200
|
* @instance
|
|
1201
1201
|
* @function
|
|
1202
1202
|
*/
|
|
1203
|
-
insertLayer:function(e,t,n,o){n=T(e,t,n),"function"==typeof o&&o(),
|
|
1203
|
+
insertLayer:function(e,t,n,o){n=T(e,t,n),"function"==typeof o&&o(),h.trigger({type:w.layerinserted,srcurl:e,srcindex:t,index:n}),h.trigger(w.layerschanged)},
|
|
1204
1204
|
/**
|
|
1205
1205
|
* Removes a layer(page annotation) of annotations. All other layers are shifted. This operation corresponds to removing page from the document.
|
|
1206
1206
|
* @param {number} index - index of the layer to be removed.
|
|
@@ -1208,7 +1208,7 @@ insertLayer:function(e,t,n,o){n=T(e,t,n),"function"==typeof o&&o(),d.trigger({ty
|
|
|
1208
1208
|
* @instance
|
|
1209
1209
|
* @function
|
|
1210
1210
|
*/
|
|
1211
|
-
removeLayer:function(e,t){var n=C(e);"function"==typeof t&&t(),
|
|
1211
|
+
removeLayer:function(e,t){var n=C(e);"function"==typeof t&&t(),h.trigger({type:w.layerremoved,layer:n,index:e}),h.trigger(w.layerschanged)},
|
|
1212
1212
|
/**
|
|
1213
1213
|
* Moves a layer of annotations from one page index to another.
|
|
1214
1214
|
* @param {number} sourceIndex - index of the layer to be moved.
|
|
@@ -1217,7 +1217,7 @@ removeLayer:function(e,t){var n=C(e);"function"==typeof t&&t(),d.trigger({type:w
|
|
|
1217
1217
|
* @instance
|
|
1218
1218
|
* @function
|
|
1219
1219
|
*/
|
|
1220
|
-
moveLayer:function(e,t,n){t=M(e,t),"function"==typeof n&&n(),
|
|
1220
|
+
moveLayer:function(e,t,n){t=M(e,t),"function"==typeof n&&n(),h.trigger({type:w.layermoved,srcindex:e,destindex:t}),h.trigger(w.layerschanged)},
|
|
1221
1221
|
/**
|
|
1222
1222
|
* Scrolls viewer to the specified annotation.
|
|
1223
1223
|
* @param {AnnotationData} anno - the annotation object to scroll to.
|
|
@@ -1349,37 +1349,37 @@ setImages:ee,
|
|
|
1349
1349
|
* @function
|
|
1350
1350
|
* @deprecated Please use {@link Atalasoft.Controls.WebDocumentViewer~AnnotationController#setStamps|annotations.setStamps} instead.
|
|
1351
1351
|
*/
|
|
1352
|
-
setStamps:$};if(e.__exposedApi=r.annotations,!t)return null;var l=n._config,s=n._pages,u=!1,
|
|
1352
|
+
setStamps:$};if(e.__exposedApi=r.annotations,!t)return null;var l=n._config,s=n._pages,u=!1,d=null,f=null,g=null,p=null,v=null,m={annos:[],activepage:null,activeanno:null,readonly:!!o,zoom:h.getZoom(),getZoom:x.getPageScale,getViewerTransform:x.getViewerTransform,getPageRotation:x.getPageRotation,annoIdsCreated:[],annoIdsModified:[],annoIdsRemoved:[],maxAnnotationId:0},b={},y=!1,_=!1,w={click:"annotationclicked",dblclick:"annotationdoubleclicked",touchstart:"annotationtouchstart",interactend:"annotationtouchend",touchmove:"annotationtouchmove",pinchmove:"annotationpinchresize",rightclick:"annotationrightclicked",mousedown:"annotationmousedown",mousedownleft:"annotationmousedownleft",mousedownright:"annotationmousedownright",mousemove:"annotationmousemove",mouseout:"annotationmouseout",mouseup:"annotationmouseup",mouseover:"annotationmouseover",annocreate:"annotationcreated",annoload:"annotationloaded",moved:"annotationmoved",rotated:"annotationrotated",annoresized:"annotationresized",repaint:"annotationrepainted",layerinserted:"layerinserted",layerremoved:"layerremoved",layermoved:"layermoved",layerschanged:"layerschanged",annotationchanged:"annotationchanged",annotationtextchanged:"annotationtextchanged",annotationspropertieswindowopened:"annotationspropertieswindowopened",annotationselected:"annotationselected",annotationdeselected:"annotationdeselected"};function z(){u=!0,m.readonly||(f=B(g),p=new Le(n._config.parent),null!=l.annotations.defaults&&K(l.annotations.defaults),null!=l.annotations.stamps&&$(l.annotations.stamps),null!=l.annotations.images&&ee(l.annotations.images),null!=l.annotations.custom&&te(l.annotations.custom))}
|
|
1353
1353
|
/**
|
|
1354
1354
|
* [Internal] Disposes memory intensive objects
|
|
1355
1355
|
* @returns undefined
|
|
1356
|
-
*/function k(e){v.translate(e.dx,e.dy)}function P(e){m.zoom=e.zoom}function T(e,t,n){e||"number"!=typeof t||(t=C(t)),t=t||[],null==n?n=m.annos.length:n<0&&(n=0);for(var o=m.annos.length,i=0;i<t.length;i++)Z(t[i],n,null);if(o<n)for(var a=o;a<m.annos.length;++a)m.annos[a]||(m.annos[a]=[]);for(var r=m.annos[n].length,l=0;l<r;l++){var s=m.annos[n][l].get().annotationId;s&&0!==s&&!de(s)||(s=le()+1,m.annos[n][l].setAnnotationId(s)),m.maxAnnotationId<s&&(m.maxAnnotationId=s),m.annos[n][l].setFIndex(n),ce(s)}return D(),n}function D(){if(m.annos){for(var e=1/0,t=m.annos.length,n=0;n<t;n++)if(m.annos[n])for(var o=m.annos[n].length,i=0;i<o;i++){var a=m.annos[n][i].get().annotationId;a<e&&(e=a)}if(e!==1/0&&1<e)for(var r=m.maxAnnotationId=0;r<t;r++)if(m.annos[r])for(var l=m.annos[r].length,s=0;s<l;s++){var c=m.annos[r][s].get().annotationId,u=c-e+1;m.annos[r][s].setAnnotationId(u),m.maxAnnotationId<u&&(m.maxAnnotationId=u);var d=m.annoIdsCreated.indexOf(c);-1<d&&(m.annoIdsCreated[d]=u),-1<(d=m.annoIdsModified.indexOf(c))&&(m.annoIdsModified[d]=u),-1<(d=m.annoIdsRemoved.indexOf(c))&&(m.annoIdsRemoved[d]=u)}}}function C(e){if(m.annos&&e<m.annos.length){if(m.annos[e])for(var t=m.annos[e].length,n=0;n<t;n++){var o=m.annos[e][n].get();o&&ue(o.annotationId)}for(var i=pn.extend(!0,{},m.annos[e]),a=m.annos[e].length-1;0<=a;a--)Y(a,e);return i}return null}function M(e,t){return T(null,C(e),t)}function E(e){e&&e.remove&&!e.grip&&e.paper&&e.paper._trash&&e.paper._trash.push(e)}function S(e){I(e.index,e.page)}function I(e,t){if(e<m.annos.length&&(F(t),m.annos[e]&&m.annos[e].length))for(var n,o=0;o<m.annos[e].length;o++)(n=m.annos[e][o])._pageindex=e,n.repaint(t._paper),n.get("selected")&&c.select(n,e,!0)}function F(e){e._grips.clear(),e._paper._annos.remove(),e._paper._annos.clear(),e._paper.forEach(function(e){e&&e.remove&&!e.grip&&e.paper&&e.paper._trash&&e.paper._trash.push(e)}),e._paper._trash.remove(),e._paper._trash.clear(),xe()}function A(e){m.activepage=e}function O(e){e.page._paper&&(F(e.page),e.page.append(e.page._paper.canvas))}function V(e){L(e.page)}function L(e){if(e&&0<=e._index&&m.annos[e._index]){for(var t=0;t<m.annos[e._index].length;t++)m.annos[e._index][t].repaint();e&&e._grips.repaint()}}function H(e){for(var t=m.annos.length,n=0;n<t;n++)if(m.annos[n])for(var o=m.annos[n].length,i=0;i<o;i++){var a=m.annos[n][i].get();if(a&&a.annotationId===e)return m.annos[n][i]}return null}function R(e){f&&(f.visible&&j(),f.remove());var t=pn.extend(!0,{},g);if(
|
|
1356
|
+
*/function k(e){v.translate(e.dx,e.dy)}function P(e){m.zoom=e.zoom}function T(e,t,n){e||"number"!=typeof t||(t=C(t)),t=t||[],null==n?n=m.annos.length:n<0&&(n=0);for(var o=m.annos.length,i=0;i<t.length;i++)Z(t[i],n,null);if(o<n)for(var a=o;a<m.annos.length;++a)m.annos[a]||(m.annos[a]=[]);for(var r=m.annos[n].length,l=0;l<r;l++){var s=m.annos[n][l].get().annotationId;s&&0!==s&&!de(s)||(s=le()+1,m.annos[n][l].setAnnotationId(s)),m.maxAnnotationId<s&&(m.maxAnnotationId=s),m.annos[n][l].setFIndex(n),ce(s)}return D(),n}function D(){if(m.annos){for(var e=1/0,t=m.annos.length,n=0;n<t;n++)if(m.annos[n])for(var o=m.annos[n].length,i=0;i<o;i++){var a=m.annos[n][i].get().annotationId;a<e&&(e=a)}if(e!==1/0&&1<e)for(var r=m.maxAnnotationId=0;r<t;r++)if(m.annos[r])for(var l=m.annos[r].length,s=0;s<l;s++){var c=m.annos[r][s].get().annotationId,u=c-e+1;m.annos[r][s].setAnnotationId(u),m.maxAnnotationId<u&&(m.maxAnnotationId=u);var d=m.annoIdsCreated.indexOf(c);-1<d&&(m.annoIdsCreated[d]=u),-1<(d=m.annoIdsModified.indexOf(c))&&(m.annoIdsModified[d]=u),-1<(d=m.annoIdsRemoved.indexOf(c))&&(m.annoIdsRemoved[d]=u)}}}function C(e){if(m.annos&&e<m.annos.length){if(m.annos[e])for(var t=m.annos[e].length,n=0;n<t;n++){var o=m.annos[e][n].get();o&&ue(o.annotationId)}for(var i=pn.extend(!0,{},m.annos[e]),a=m.annos[e].length-1;0<=a;a--)Y(a,e);return i}return null}function M(e,t){return T(null,C(e),t)}function E(e){e&&e.remove&&!e.grip&&e.paper&&e.paper._trash&&e.paper._trash.push(e)}function S(e){I(e.index,e.page)}function I(e,t){if(e<m.annos.length&&(F(t),m.annos[e]&&m.annos[e].length))for(var n,o=0;o<m.annos[e].length;o++)(n=m.annos[e][o])._pageindex=e,n.repaint(t._paper),n.get("selected")&&c.select(n,e,!0)}function F(e){e._grips.clear(),e._paper._annos.remove(),e._paper._annos.clear(),e._paper.forEach(function(e){e&&e.remove&&!e.grip&&e.paper&&e.paper._trash&&e.paper._trash.push(e)}),e._paper._trash.remove(),e._paper._trash.clear(),xe()}function A(e){m.activepage=e}function O(e){e.page._paper&&(F(e.page),e.page.append(e.page._paper.canvas))}function V(e){L(e.page)}function L(e){if(e&&0<=e._index&&m.annos[e._index]){for(var t=0;t<m.annos[e._index].length;t++)m.annos[e._index][t].repaint();e&&e._grips.repaint()}}function H(e){for(var t=m.annos.length,n=0;n<t;n++)if(m.annos[n])for(var o=m.annos[n].length,i=0;i<o;i++){var a=m.annos[n][i].get();if(a&&a.annotationId===e)return m.annos[n][i]}return null}function R(e){f&&(f.visible&&j(),f.remove());var t=pn.extend(!0,{},g);if(h.trigger("contextmenu",[m.activeanno.getClonedData(),t]),pn.isEmptyObject(t))f=null;else{for(var n in t)t.hasOwnProperty(n)&&(t[n]=N(t[n]));f=B(t)}!function(e){if(f){var t=Fn.GetAnnotationLocalizedString("menuPropertiesButton"),n=Fn.GetAnnotationLocalizedString("menuDeleteButton");if(m.activeanno.get("readonly"))f.children(":contains("+t+")").off("click").children("a, div").css("color","#cdc9c9"),f.children(":contains("+n+")").off("click").children("a, div").css("color","#cdc9c9");else{var o=f.children(":contains("+t+")");void 0!==o.data("events")&&"click"in o.data("events")||o.on("click",W),o.children("a").css("color","#000000")}0===f.closest().length&&d.prepend(f);var i={x:e.x-6,y:e.y-6};f.css({left:i.x,top:i.y}),f.show(),f.visible=!0}}(e)}function j(){f&&(f.hide(),f.visible=!1)}function B(e){var t=x.createMenu(e);return t.css({position:"fixed","z-index":99999}),t.mouseleave(j),t.visible=!1,t}function N(e){return function(){return j(),e.call(this,m.activeanno.getClonedData())}}function q(){var e=m.activepage?m.activepage._index:0;if(m.annos[e]){var t=pn.inArray(m.activeanno,m.annos[e]);-1!==t&&(m.activeanno=null,Y(t,e))}j()}function W(){h.trigger({type:"annotationspropertieswindowopened",annotation:m.activeanno}),j(),p.show(m.activeanno)}
|
|
1357
1357
|
/**
|
|
1358
1358
|
* Clears the annotations and related data from all pages
|
|
1359
1359
|
*/
|
|
1360
|
-
function U(){var e=m.annos.length;if(0<e){for(var t=0;t<e;t++)if(m.annos[t])for(var n=m.annos[t].length,o=0;o<n;o++){var i=m.annos[t][o].get();i&&ue(i.annotationId)}if(m.annos.length=0,s)for(var a=0;a<s.length;a++)s[a]._grips.clear(),s[a]._paper.forEach(E),s[a]._paper._trash.remove(),s[a]._paper._trash.clear(),s[a]._paper._annos.remove(),s[a]._paper._annos.clear();
|
|
1360
|
+
function U(){var e=m.annos.length;if(0<e){for(var t=0;t<e;t++)if(m.annos[t])for(var n=m.annos[t].length,o=0;o<n;o++){var i=m.annos[t][o].get();i&&ue(i.annotationId)}if(m.annos.length=0,s)for(var a=0;a<s.length;a++)s[a]._grips.clear(),s[a]._paper.forEach(E),s[a]._paper._trash.remove(),s[a]._paper._trash.clear(),s[a]._paper._annos.remove(),s[a]._paper._annos.clear();h.trigger({type:"annotationscleared"})}}
|
|
1361
1361
|
/**
|
|
1362
1362
|
* Creates an annotation on the desired page with the given annotation data.
|
|
1363
1363
|
* @param aConfig: object, Key value pairs representing annotation data.
|
|
1364
1364
|
* @param pgNum: number, The zero based index of the page the annotation should be created on.
|
|
1365
1365
|
* @param callback: function, Function to be called when the operation has completed.
|
|
1366
1366
|
* @returns object: Atalasoft.Annotations.Annotation.
|
|
1367
|
-
*/function Z(e,t,n){var o={};e.multiview?o=e:(e&&e.type&&b[e.type]&&pn.extend(!0,o,b[e.type]),pn.extend(!0,o,e));var i=new Oe(
|
|
1367
|
+
*/function Z(e,t,n){var o={};e.multiview?o=e:(e&&e.type&&b[e.type]&&pn.extend(!0,o,b[e.type]),pn.extend(!0,o,e));var i=new Oe(h,o,m);i._pageindex=t,i.setFIndex(t);var a=i.get().annotationId;return a&&0!==a&&!de(a)||(a=le()+1,i.setAnnotationId(a)),m.maxAnnotationId<a&&(m.maxAnnotationId=a),void 0===m.annos[t]&&(m.annos[t]=[]),m.annos[t].push(i),ce(a),x.redrawPageFromIndex(t,!0),"function"==typeof n&&n(i),_e(i),h.trigger({type:w.annocreate,anno:i,annotation:i,page:t}),i}function X(e,t,n){return Z(e,t,n).getClonedData()}function G(e,t){Y(t,e)}
|
|
1368
1368
|
/**
|
|
1369
1369
|
* Deletes an annotation on the given z-index and zero based page index.
|
|
1370
1370
|
* @param annIndex: number, Zero based z-index of the annotation.
|
|
1371
1371
|
* @param pgNum: number, Zero based page index the annotation is located on.
|
|
1372
|
-
*/function Y(e,t){var n=m.annos[t].splice(e,1)[0],o=n.get();o&&ue(o.annotationId),m.activepage&&m.activepage._paper&&m.activepage._paper._annos.exclude(n.getObject()),m.activeanno===n&&(m.activeanno=null),n.dispose(),m.activepage&&m.activepage._grips&&m.activepage._grips.repaint(),
|
|
1372
|
+
*/function Y(e,t){var n=m.annos[t].splice(e,1)[0],o=n.get();o&&ue(o.annotationId),m.activepage&&m.activepage._paper&&m.activepage._paper._annos.exclude(n.getObject()),m.activeanno===n&&(m.activeanno=null),n.dispose(),m.activepage&&m.activepage._grips&&m.activepage._grips.repaint(),h.trigger({type:"annotationdeleted",page:t,index:e})}function J(e){var n=this,t=[];if(0===m.annos.length||void 0===m.annos[e])return t;for(var o=0;o<m.annos[e].length;o++)t[o]=m.annos[e][o].getClonedData();return t.sort(function(e,t){return Re(this,n),e.tabindex-t.tabindex}.bind(this))}function Q(e,t){if(isFinite(t)){if(t<m.annos.length)for(var n=0;n<m.annos[t].length;++n)if(m.annos[t][n].isCloneSource(e))return m.annos[t][n]}else for(var o=0;o<m.annos.length;++o){var i=Q(e,o);if(i)return i}return null}function K(e){l.annotations.defaults=e;for(var t=0;t<e.length;t++)"string"==typeof e[t].type&&(b[e[t].type]=e[t]);return h}function $(e){l.annotations.stamps=e;for(var t=0;t<e.length;t++)Ie(e[t]);if(u){var n={type:"button",id:x._id+"_toolbar_Button_Stamp",icon:"stamp",tooltip:"Draw Stamp",text:""},o=x.createDropDownButton(n);n.onclick=x.drawAnnotation,x.createDropDownMenu(o,n,e)}return h}function ee(e){l.annotations.images=e;for(var t=0;t<e.length;t++)e[t].type="image";if(u){var n={type:"button",id:x._id+"_toolbar_Button_Image",icon:"image",tooltip:"Draw Image",text:""},o=x.createDropDownButton(n);n.onclick=x.drawAnnotation,x.createDropDownMenu(o,n,e)}return h}
|
|
1373
1373
|
/**
|
|
1374
1374
|
* Sets the default annotation properties for initially created custom annotations. This accepts the same input as the main config.
|
|
1375
1375
|
* @param cConfig: array, An array of JSON objects representing custom annotation types.
|
|
1376
1376
|
* @returns object: Atalasoft.Controls.WebDocumentViewer
|
|
1377
|
-
*/function te(e){l.annotations.custom=e;for(var t=0;t<e.length;t++)e[t].type="custom";if(u){var n={type:"button",id:x._id+"_toolbar_Button_Custom",icon:"image",tooltip:"Draw Custom",text:""},o=x.createDropDownButton(n);n.onclick=x.drawAnnotation,x.createDropDownMenu(o,n,e)}return d}function ne(e,t){if("text"===e.type&&e){var n=e.getPageIndex(),o=Q(e,n);t?e.visible&&(x.isPageInView(n)?oe(o,n):d.showPage(e.getPageIndex(),function(){oe(o,n)})):o.trigger("hideeditor")}}function oe(e,t){e&&(!1!==e.get("selectable")&&c.select(e,t,!1),e.trigger("showeditor"))}function ie(e,t){var n={atala_spath:x._config.savepath,atala_annurl:x._config.annotationsurl};pn.extend(n,e);var o={type:"atalaannosave",serverurl:x._config.serverurl,query:"?atalaannosave=",method:"POST",data:n,cancel:!1,info:{success:void 0,error:void 0}};function i(e){e.error&&x.throwError("AnnotationSaveError",e.error),x.triggerEvent({type:"documentsaved",success:e.success,error:e.error}),"function"==typeof t&&t.call()}x.makeHandlerRequest(o,i,function(e){var t=[];t.error=e.responseText,i(t)})}function ae(e,t){var n={};pn.extend(n,e);var o={type:"atalaannoload",serverurl:x._config.serverurl,query:"?atalaannoload=",method:"GET",data:n,cancel:!1,info:{success:void 0,error:void 0}};function i(e){e.error&&x.throwError("AnnotationLoadError",e.error),"function"==typeof t&&t.call(),function(e){var t=0;if(e.startindex&&(t=e.startindex),e.layers){for(var n=0;n<e.layers.length;n++){e.offset=e.offset||0;var o=e.offset+n,i=e.layers[n];if(i){if(i._index=isFinite(i._index+t)&&0<=i._index+t?i._index+t:o+t,i.visible=void 0===i.visible||i.visible,i.items)for(var a=0;a<i.items.length;a++){i.items[a].visible=i.items[a].visible&&i.visible;var r=new Oe(d,i.items[a],m);r._pageindex=i._index,r.setFIndex(i._index);var l=r.annotationId;l&&0!==l&&!de(l)||(l=le()+1),r.setAnnotationId(l),m.maxAnnotationId<l&&(m.maxAnnotationId=l),m.annos[i._index]||(m.annos[i._index]=[]),m.annos[i._index].push(r);var s=r.getClonedData();d.trigger({type:w.annoload,anno:s,annotation:s,customData:e.customData}),_e(m.annos[i._index][m.annos[i._index].length-1])}x.redrawPageFromIndex(i._index,!0)}}D(),c.deselectAll()}}(e)}x.makeHandlerRequest(o,i,function(e){var t=[];t.error=e.responseText,i(t)})}function re(e){A(e),c.deselectPage(e),j()}function le(){if(!m||!m.annos)return 0;if(0<m.maxAnnotationId){var e=m.maxAnnotationId;return m.maxAnnotationId++,e}for(var t=m.annos.length,n=0,o=0;o<t;o++)if(m.annos[o]){n=m.annos[o].length;for(var i=0;i<n;i++){var a=m.annos[o][i].get();a&&a.annotationId&&a.annotationId>m.maxAnnotationId&&(m.maxAnnotationId=a.annotationId)}}return m.maxAnnotationId}function se(e){if(e){var t=m.annoIdsCreated.indexOf(e);0<=t&&m.annoIdsCreated.splice(t,1),0<=(t=m.annoIdsModified.indexOf(e))&&m.annoIdsModified.splice(t,1),0<=(t=m.annoIdsRemoved.indexOf(e))&&m.annoIdsRemoved.splice(t,1)}}function ce(e){if(e){m.annoIdsCreated.indexOf(e)<0&&m.annoIdsCreated.push(e);var t=m.annoIdsModified.indexOf(e);0<=t&&m.annoIdsModified.splice(t,1),0<=(t=m.annoIdsRemoved.indexOf(e))&&m.annoIdsRemoved.splice(t,1)}}function ue(e){if(e){var t=m.annoIdsCreated.indexOf(e);0<=t?m.annoIdsCreated.splice(t,1):(m.annoIdsRemoved.indexOf(e)<0&&m.annoIdsRemoved.push(e),0<=(t=m.annoIdsModified.indexOf(e))&&m.annoIdsModified.splice(t,1))}}function de(e){if(!m||!m.annos||!e)return!1;for(var t=m.annos.length,n=0,o=0;o<t;o++)if(m.annos[o]){n=m.annos[o].length;for(var i=0;i<n;i++){var a=m.annos[o][i].get();if(a&&a.annotationId&&a.annotationId===e)return!0}}return!1}function he(e,t,n,o){if(y)return null;var i=pn.extend(!0,{},e);return e&&e.type&&b[e.type]&&(i=pn.extend(!0,i,b[e.type]),t&&(i=pn.extend(!0,i,e))),i.rotation=0,m.activeanno&&null===m.activeanno.getObject()&&be(),function(){if(!_){h.on("mousedown",ve),mn.Features.Touch&&h.on("touchstart",ve);for(var e=0;e<s.length;e++)s[e]._draw.toFront();_=!0}}(),m.activeanno=new Oe(d,i,m),m.activeanno.bind({drawn:me,cancelled:be}),"function"==typeof n&&(fe=n),"function"==typeof o&&(ge=o),m.activeanno}c.setAnnos(m.annos),c.setPages(s),function(){var T,D,C,u=vn.svg&&!mn.Features.foreignObject;function a(e,t,n,o,i,a){var r=u||a?"image":"foreignObject",l=d(this,this,"http://www.w3.org/2000/svg",r,t,n,o,i),s=null;if(!u){s=document.createElementNS("http://www.w3.org/1999/xhtml","div");var c="http://www.w3.org/2000/xmlns/";s.setAttributeNS(c,"xmlns",c),s.innerHTML=e||"",l.node.appendChild(s),l.isHtml=!0}return l.innerDom=s,l}function d(e,t,n,o,i,a,r,l,s){var c=null===n?document.createElement(o):document.createElementNS(n,o);t.canvas&&t.canvas.appendChild&&t.canvas.appendChild(c);var u=new e.constructor.el.constructor(c,e);for(var d in u.attrs={x:i,y:a,width:r,height:l,r:s||0,rx:s||0,ry:s||0,fill:"none",stroke:"#000"},u.skew={},"g"===(u.type=o)&&(u.canvas=u.node),u.attrs)u.attrs.hasOwnProperty(d)&&void 0!==u.attrs[d]&&c.setAttribute(d,u.attrs[d]+"");return u}vn.vml?vn.fn.html=function(e,t,n,o,i){var a=d(this,this,null,"div",t,n,o,i),r=a.node;function l(e){var t=a.matrix.split();if(e.hasOwnProperty("x")&&void 0!==e.x&&e.hasOwnProperty("y")&&void 0!==e.y){var n={x:e.x*t.scalex,y:e.y*t.scaley};if(0!==t.rotate){var o=Ae([{x:e.x,y:e.y},{x:e.x+e.width,y:e.y},{x:e.x+e.width,y:e.y+e.height},{x:e.x,y:e.y+e.height}],a.matrix);n=o}r.style.left=Math.round(n.x)+"px",r.style.top=Math.round(n.y)+"px"}}return r.innerHTML=e||"",(a.innerDom=r).style.position="absolute",a.__tsfm=a.transform,a.transform=function(){this.__tsfm.apply(this,arguments),this.repaint(),l(this.attrs)},a.backgroundColor=function(e){r.style.backgroundColor=e,this.repaint()},a.repaint=function(){r.style.filter='progid:DXImageTransform.Microsoft.Chroma(color="'+r.style.backgroundColor+'"); '+this.matrix.toFilter()},a.__attr=a.attr,a.attr=function(e){this.__attr.apply(this,arguments),e&&(l(e),e.hasOwnProperty("width")&&(r.style.width=e.width+"px"),e.hasOwnProperty("height")&&(r.style.height=e.height+"px"))},a.isHtml=!0,a}:(vn.fn.html=function(e,t,n,o,i){return a.call(this,e,t,n,o,i)},T={block:"M5,0 0,2.5 5,5z",classic:"M5,0 0,2.5 5,5 3.5,3 3.5,2z",diamond:"M2.5,0 5,2.5 2.5,5 0,2.5z",open:"M6,1 1,3.5 6,6",oval:"M2.5,0A2.5,2.5,0,0,1,2.5,5 2.5,2.5,0,0,1,2.5,0z"},D={},C=function e(t,n){if(n)for(var o in"string"==typeof t&&(t=e(t)),n)n.hasOwnProperty(o)&&("xlink:"===o.substring(0,6)?t.setAttributeNS("http://www.w3.org/1999/xlink",o.substring(6),String(n[o])):t.setAttribute(o,String(n[o])));else(t=vn._g.doc.createElementNS("http://www.w3.org/2000/svg",t)).style&&(t.style.webkitTapHighlightColor="rgba(0,0,0,0)");return t},vn.fn.addArrow=function(e,t,n){if("path"===e.type){for(var o,i,a,r,l,s=String(t).toLowerCase().split("-"),c=e.paper,u=n?"end":"start",d=e.node,h=e.attrs,f=h["stroke-width"],g=s.length,p="classic",v=3,m=3,b=5;g--;)switch(s[g]){case"block":case"classic":case"oval":case"diamond":case"open":case"none":p=s[g];break;case"wide":m=5;break;case"narrow":m=2;break;case"long":v=5;break;case"short":v=2}if(l="open"===p?(v+=2,m+=2,b+=2,a=1,r=n?4:1,{fill:"none",stroke:h.stroke}):(r=a=v/2,{fill:h.stroke,stroke:"none"}),e._.WDVarrows?n?(e._.WDVarrows.endPath&&D[e._.WDVarrows.endPath]--,e._.WDVarrows.endMarker&&D[e._.WDVarrows.endMarker]--):(e._.WDVarrows.startPath&&D[e._.WDVarrows.startPath]--,e._.WDVarrows.startMarker&&D[e._.WDVarrows.startMarker]--):e._.WDVarrows={},"none"!==p){var x=Math.random().toString(36).substring(7),y="dave-marker-"+p,_="dave-marker-"+u+p+v+m+x;vn._g.doc.getElementById(y)?D[y]++:(c.defs.appendChild(C(C("path"),{"stroke-linecap":"round",d:T[p],id:y})),D[y]=1);var w,z=vn._g.doc.getElementById(_);z?(D[_]++,w=z.getElementsByTagName("use")[0]):(z=C(C("marker"),{id:_,markerHeight:m,markerWidth:v,orient:"auto",refX:r,refY:m/2}),w=C(C("use"),{"xlink:href":"#"+y,transform:(n?"rotate(180 "+v/2+" "+m/2+") ":"")+"scale("+v/b+","+m/b+")","stroke-width":(1/((v/b+m/b)/2)).toFixed(4)}),z.appendChild(w),c.defs.appendChild(z),D[_]=1),C(w,l);var k=a*("diamond"!==p&&"oval"!==p);i=(i=n?(o=e._.WDVarrows.startdx*f||0,vn.getTotalLength(h.path)-k*f):(o=k*f,vn.getTotalLength(h.path)-(e._.WDVarrows.enddx*f||0)))<0?0:i,(l={})["marker-"+u]="url(#"+_+")",(i||o)&&(l.d=vn.getSubpath(h.path,o,i)),C(d,l),e._.WDVarrows[u+"Path"]=y,e._.WDVarrows[u+"Marker"]=_,e._.WDVarrows[u+"dx"]=k,e._.WDVarrows[u+"Type"]=p,e._.WDVarrows[u+"String"]=t}else i=n?(o=e._.WDVarrows.startdx*f||0,vn.getTotalLength(h.path)-o):(o=0,vn.getTotalLength(h.path)-(e._.WDVarrows.enddx*f||0)),e._.WDVarrows[u+"Path"]&&C(d,{d:vn.getSubpath(h.path,o,i)}),delete e._.WDVarrows[u+"Path"],delete e._.WDVarrows[u+"Marker"],delete e._.WDVarrows[u+"dx"],delete e._.WDVarrows[u+"Type"],delete e._.WDVarrows[u+"String"];for(l in D)if(D.hasOwnProperty(l)&&!D[l]){var P=vn._g.doc.getElementById(l);P&&P.parentNode.removeChild(P)}}}),vn.fn.atalaImage=function(e,t,n,o,i){return a.call(this,e,t,n,o,i,!0)}}(),v=vn.matrix(1,0,0,1,0,0),d.bind({scroll:k,pagerecycled:O,pageshown:S,zoomchanged:P,pagerotated:V}),(g={})[Fn.GetAnnotationLocalizedString("menuDeleteButton")]=q,g[Fn.GetAnnotationLocalizedString("menuPropertiesButton")]=W,x._state.initialized?z():d.bind({initialized:z}),"Atalasoft.Controls.WebDocumentViewer"===d.typeOf&&pn.extend(d,r),a.__exposedApi=r.annotations,a.addDrawingSurface=function(n){var e=this;if(n instanceof pn){n._paper=vn(n[0]),n._paper.canvas.style.position="absolute",n._paper.canvas.style.zIndex="2",0<l.pageborderwidth&&(n._paper.canvas.style.left=l.pageborderwidth+"px",n._paper.canvas.style.top=l.pageborderwidth+"px"),n._paper._annos=n._paper.set(),n._paper._trash=n._paper.set(),(n._paper._page=n)._matrix=vn.matrix(1,0,0,1,0,0),n._matrix.translate(-n.offset().left,-n.offset().top),n._grips=new He(n,m);var t=function(){Re(this,e),re(n)}.bind(this);return n.on("mousedown",t),mn.Features.Touch&&n.on("touchstart",t),n.on({pageresize:function(e){var t;e.page=n,(t=e).page._paper.setSize(t.width,t.height),t.page._paper.canvas.style.width=t.width,t.page._paper.canvas.style.height=t.height,L(t.page)},pagezoom:function(e){var t;e.page=n,t=e,isFinite(t.width)&&isFinite(t.height)&&t.width&&t.height&&(m.zoom=t.zoom,t.page._paper.setSize(t.width,t.height),t.page._paper.canvas.style.width=t.width,t.page._paper.canvas.style.height=t.height,t.page._paper.forEach(function(e){if(e&&e.transform&&!e.grip){void 0!==e._linewidth&&e.attr("stroke-width",e._linewidth*m.zoom);var t=e.attr("clip-rect");"object"==typeof t&&"number"==typeof t.length&&e.attr("clip-rect",t)}}),L(t.page))}}),!0}return!1},a.removeDrawingSurface=function(e){return e instanceof pn&&(e._paper&&(e._paper._annos=null,e._paper._page=null,e._paper=null),e._matrix=null,!(e._grips=null))},a.insertLayer=T,a.removeLayer=C,a.moveLayer=M,a.showLayer=I,a.getAnnotationById=H,a.clear=U,a.createAnnotation=Z,a.deleteAnnoOnPage=G,a.drawAnnotation=he,a.getAnnosFromPage=J,a.setStamps=$,a.setAnnotationDefaults=K,a.setImages=ee,a.setCustom=te,a.dispose=function(){p=g=f=h=s=l=x=d=a=null,m.annos.length=0,m.annoIdsCreated.length=0,m.annoIdsModified.length=0,m.annoIdsRemoved.length=0,m.activepage=null,m.activeanno=null,m.zoom=null,c.dispose(),c=null},
|
|
1377
|
+
*/function te(e){l.annotations.custom=e;for(var t=0;t<e.length;t++)e[t].type="custom";if(u){var n={type:"button",id:x._id+"_toolbar_Button_Custom",icon:"image",tooltip:"Draw Custom",text:""},o=x.createDropDownButton(n);n.onclick=x.drawAnnotation,x.createDropDownMenu(o,n,e)}return h}function ne(e,t){if("text"===e.type&&e){var n=e.getPageIndex(),o=Q(e,n);t?e.visible&&(x.isPageInView(n)?oe(o,n):h.showPage(e.getPageIndex(),function(){oe(o,n)})):o.trigger("hideeditor")}}function oe(e,t){e&&(!1!==e.get("selectable")&&c.select(e,t,!1),e.trigger("showeditor"))}function ie(e,t){var n={atala_spath:x._config.savepath,atala_annurl:x._config.annotationsurl};pn.extend(n,e);var o={type:"atalaannosave",serverurl:x._config.serverurl,query:"?atalaannosave=",method:"POST",data:n,cancel:!1,info:{success:void 0,error:void 0}};function i(e){e.error&&x.throwError("AnnotationSaveError",e.error),x.triggerEvent({type:"documentsaved",success:e.success,error:e.error}),"function"==typeof t&&t.call()}x.makeHandlerRequest(o,i,function(e){var t=[];t.error=e.responseText,i(t)})}function ae(e,t){var n={};pn.extend(n,e);var o={type:"atalaannoload",serverurl:x._config.serverurl,query:"?atalaannoload=",method:"GET",data:n,cancel:!1,info:{success:void 0,error:void 0}};function i(e){e.error&&x.throwError("AnnotationLoadError",e.error),"function"==typeof t&&t.call(),function(e){var t=0;if(e.startindex&&(t=e.startindex),e.layers){for(var n=0;n<e.layers.length;n++){e.offset=e.offset||0;var o=e.offset+n,i=e.layers[n];if(i){if(i._index=isFinite(i._index+t)&&0<=i._index+t?i._index+t:o+t,i.visible=void 0===i.visible||i.visible,i.items)for(var a=0;a<i.items.length;a++){i.items[a].visible=i.items[a].visible&&i.visible;var r=new Oe(h,i.items[a],m);r._pageindex=i._index,r.setFIndex(i._index);var l=i.items[a].annotationId;l&&0!==l&&!de(l)||(l=le()+1),r.setAnnotationId(l),m.maxAnnotationId<l&&(m.maxAnnotationId=l),m.annos[i._index]||(m.annos[i._index]=[]),m.annos[i._index].push(r);var s=r.getClonedData();h.trigger({type:w.annoload,anno:s,annotation:s,customData:e.customData}),_e(m.annos[i._index][m.annos[i._index].length-1])}x.redrawPageFromIndex(i._index,!0)}}D(),c.deselectAll()}}(e)}x.makeHandlerRequest(o,i,function(e){var t=[];t.error=e.responseText,i(t)})}function re(e){A(e),c.deselectPage(e),j()}function le(){if(!m||!m.annos)return 0;if(0<m.maxAnnotationId){var e=m.maxAnnotationId;return m.maxAnnotationId++,e}for(var t=m.annos.length,n=0,o=0;o<t;o++)if(m.annos[o]){n=m.annos[o].length;for(var i=0;i<n;i++){var a=m.annos[o][i].get();a&&a.annotationId&&a.annotationId>m.maxAnnotationId&&(m.maxAnnotationId=a.annotationId)}}return m.maxAnnotationId}function se(e){if(e){var t=m.annoIdsCreated.indexOf(e);0<=t&&m.annoIdsCreated.splice(t,1),0<=(t=m.annoIdsModified.indexOf(e))&&m.annoIdsModified.splice(t,1),0<=(t=m.annoIdsRemoved.indexOf(e))&&m.annoIdsRemoved.splice(t,1)}}function ce(e){if(e){m.annoIdsCreated.indexOf(e)<0&&m.annoIdsCreated.push(e);var t=m.annoIdsModified.indexOf(e);0<=t&&m.annoIdsModified.splice(t,1),0<=(t=m.annoIdsRemoved.indexOf(e))&&m.annoIdsRemoved.splice(t,1)}}function ue(e){if(e){var t=m.annoIdsCreated.indexOf(e);0<=t?m.annoIdsCreated.splice(t,1):(m.annoIdsRemoved.indexOf(e)<0&&m.annoIdsRemoved.push(e),0<=(t=m.annoIdsModified.indexOf(e))&&m.annoIdsModified.splice(t,1))}}function de(e){if(!m||!m.annos||!e)return!1;for(var t=m.annos.length,n=0,o=0;o<t;o++)if(m.annos[o]){n=m.annos[o].length;for(var i=0;i<n;i++){var a=m.annos[o][i].get();if(a&&a.annotationId&&a.annotationId===e)return!0}}return!1}function he(e,t,n,o){if(y)return null;var i=pn.extend(!0,{},e);return e&&e.type&&b[e.type]&&(i=pn.extend(!0,i,b[e.type]),t&&(i=pn.extend(!0,i,e))),i.rotation=0,m.activeanno&&null===m.activeanno.getObject()&&be(),function(){if(!_){d.on("mousedown",ve),mn.Features.Touch&&d.on("touchstart",ve);for(var e=0;e<s.length;e++)s[e]._draw.toFront();_=!0}}(),m.activeanno=new Oe(h,i,m),m.activeanno.bind({drawn:me,cancelled:be}),"function"==typeof n&&(fe=n),"function"==typeof o&&(ge=o),m.activeanno}c.setAnnos(m.annos),c.setPages(s),function(){var T,D,C,u=vn.svg&&!mn.Features.foreignObject;function a(e,t,n,o,i,a){var r=u||a?"image":"foreignObject",l=d(this,this,"http://www.w3.org/2000/svg",r,t,n,o,i),s=null;if(!u){s=document.createElementNS("http://www.w3.org/1999/xhtml","div");var c="http://www.w3.org/2000/xmlns/";s.setAttributeNS(c,"xmlns",c),s.innerHTML=e||"",l.node.appendChild(s),l.isHtml=!0}return l.innerDom=s,l}function d(e,t,n,o,i,a,r,l,s){var c=null===n?document.createElement(o):document.createElementNS(n,o);t.canvas&&t.canvas.appendChild&&t.canvas.appendChild(c);var u=new e.constructor.el.constructor(c,e);for(var d in u.attrs={x:i,y:a,width:r,height:l,r:s||0,rx:s||0,ry:s||0,fill:"none",stroke:"#000"},u.skew={},"g"===(u.type=o)&&(u.canvas=u.node),u.attrs)u.attrs.hasOwnProperty(d)&&void 0!==u.attrs[d]&&c.setAttribute(d,u.attrs[d]+"");return u}vn.vml?vn.fn.html=function(e,t,n,o,i){var a=d(this,this,null,"div",t,n,o,i),r=a.node;function l(e){var t=a.matrix.split();if(e.hasOwnProperty("x")&&void 0!==e.x&&e.hasOwnProperty("y")&&void 0!==e.y){var n={x:e.x*t.scalex,y:e.y*t.scaley};if(0!==t.rotate){var o=Ae([{x:e.x,y:e.y},{x:e.x+e.width,y:e.y},{x:e.x+e.width,y:e.y+e.height},{x:e.x,y:e.y+e.height}],a.matrix);n=o}r.style.left=Math.round(n.x)+"px",r.style.top=Math.round(n.y)+"px"}}return r.innerHTML=e||"",(a.innerDom=r).style.position="absolute",a.__tsfm=a.transform,a.transform=function(){this.__tsfm.apply(this,arguments),this.repaint(),l(this.attrs)},a.backgroundColor=function(e){r.style.backgroundColor=e,this.repaint()},a.repaint=function(){r.style.filter='progid:DXImageTransform.Microsoft.Chroma(color="'+r.style.backgroundColor+'"); '+this.matrix.toFilter()},a.__attr=a.attr,a.attr=function(e){this.__attr.apply(this,arguments),e&&(l(e),e.hasOwnProperty("width")&&(r.style.width=e.width+"px"),e.hasOwnProperty("height")&&(r.style.height=e.height+"px"))},a.isHtml=!0,a}:(vn.fn.html=function(e,t,n,o,i){return a.call(this,e,t,n,o,i)},T={block:"M5,0 0,2.5 5,5z",classic:"M5,0 0,2.5 5,5 3.5,3 3.5,2z",diamond:"M2.5,0 5,2.5 2.5,5 0,2.5z",open:"M6,1 1,3.5 6,6",oval:"M2.5,0A2.5,2.5,0,0,1,2.5,5 2.5,2.5,0,0,1,2.5,0z"},D={},C=function e(t,n){if(n)for(var o in"string"==typeof t&&(t=e(t)),n)n.hasOwnProperty(o)&&("xlink:"===o.substring(0,6)?t.setAttributeNS("http://www.w3.org/1999/xlink",o.substring(6),String(n[o])):t.setAttribute(o,String(n[o])));else(t=vn._g.doc.createElementNS("http://www.w3.org/2000/svg",t)).style&&(t.style.webkitTapHighlightColor="rgba(0,0,0,0)");return t},vn.fn.addArrow=function(e,t,n){if("path"===e.type){for(var o,i,a,r,l,s=String(t).toLowerCase().split("-"),c=e.paper,u=n?"end":"start",d=e.node,h=e.attrs,f=h["stroke-width"],g=s.length,p="classic",v=3,m=3,b=5;g--;)switch(s[g]){case"block":case"classic":case"oval":case"diamond":case"open":case"none":p=s[g];break;case"wide":m=5;break;case"narrow":m=2;break;case"long":v=5;break;case"short":v=2}if(l="open"===p?(v+=2,m+=2,b+=2,a=1,r=n?4:1,{fill:"none",stroke:h.stroke}):(r=a=v/2,{fill:h.stroke,stroke:"none"}),e._.WDVarrows?n?(e._.WDVarrows.endPath&&D[e._.WDVarrows.endPath]--,e._.WDVarrows.endMarker&&D[e._.WDVarrows.endMarker]--):(e._.WDVarrows.startPath&&D[e._.WDVarrows.startPath]--,e._.WDVarrows.startMarker&&D[e._.WDVarrows.startMarker]--):e._.WDVarrows={},"none"!==p){var x=Math.random().toString(36).substring(7),y="dave-marker-"+p,_="dave-marker-"+u+p+v+m+x;vn._g.doc.getElementById(y)?D[y]++:(c.defs.appendChild(C(C("path"),{"stroke-linecap":"round",d:T[p],id:y})),D[y]=1);var w,z=vn._g.doc.getElementById(_);z?(D[_]++,w=z.getElementsByTagName("use")[0]):(z=C(C("marker"),{id:_,markerHeight:m,markerWidth:v,orient:"auto",refX:r,refY:m/2}),w=C(C("use"),{"xlink:href":"#"+y,transform:(n?"rotate(180 "+v/2+" "+m/2+") ":"")+"scale("+v/b+","+m/b+")","stroke-width":(1/((v/b+m/b)/2)).toFixed(4)}),z.appendChild(w),c.defs.appendChild(z),D[_]=1),C(w,l);var k=a*("diamond"!==p&&"oval"!==p);i=(i=n?(o=e._.WDVarrows.startdx*f||0,vn.getTotalLength(h.path)-k*f):(o=k*f,vn.getTotalLength(h.path)-(e._.WDVarrows.enddx*f||0)))<0?0:i,(l={})["marker-"+u]="url(#"+_+")",(i||o)&&(l.d=vn.getSubpath(h.path,o,i)),C(d,l),e._.WDVarrows[u+"Path"]=y,e._.WDVarrows[u+"Marker"]=_,e._.WDVarrows[u+"dx"]=k,e._.WDVarrows[u+"Type"]=p,e._.WDVarrows[u+"String"]=t}else i=n?(o=e._.WDVarrows.startdx*f||0,vn.getTotalLength(h.path)-o):(o=0,vn.getTotalLength(h.path)-(e._.WDVarrows.enddx*f||0)),e._.WDVarrows[u+"Path"]&&C(d,{d:vn.getSubpath(h.path,o,i)}),delete e._.WDVarrows[u+"Path"],delete e._.WDVarrows[u+"Marker"],delete e._.WDVarrows[u+"dx"],delete e._.WDVarrows[u+"Type"],delete e._.WDVarrows[u+"String"];for(l in D)if(D.hasOwnProperty(l)&&!D[l]){var P=vn._g.doc.getElementById(l);P&&P.parentNode.removeChild(P)}}}),vn.fn.atalaImage=function(e,t,n,o,i){return a.call(this,e,t,n,o,i,!0)}}(),v=vn.matrix(1,0,0,1,0,0),h.bind({scroll:k,pagerecycled:O,pageshown:S,zoomchanged:P,pagerotated:V}),(g={})[Fn.GetAnnotationLocalizedString("menuDeleteButton")]=q,g[Fn.GetAnnotationLocalizedString("menuPropertiesButton")]=W,x._state.initialized?z():h.bind({initialized:z}),"Atalasoft.Controls.WebDocumentViewer"===h.typeOf&&pn.extend(h,r),a.__exposedApi=r.annotations,a.addDrawingSurface=function(n){var e=this;if(n instanceof pn){n._paper=vn(n[0]),n._paper.canvas.style.position="absolute",n._paper.canvas.style.zIndex="2",0<l.pageborderwidth&&(n._paper.canvas.style.left=l.pageborderwidth+"px",n._paper.canvas.style.top=l.pageborderwidth+"px"),n._paper._annos=n._paper.set(),n._paper._trash=n._paper.set(),(n._paper._page=n)._matrix=vn.matrix(1,0,0,1,0,0),n._matrix.translate(-n.offset().left,-n.offset().top),n._grips=new He(n,m);var t=function(){Re(this,e),re(n)}.bind(this);return n.on("mousedown",t),mn.Features.Touch&&n.on("touchstart",t),n.on({pageresize:function(e){var t;e.page=n,(t=e).page._paper.setSize(t.width,t.height),t.page._paper.canvas.style.width=t.width,t.page._paper.canvas.style.height=t.height,L(t.page)},pagezoom:function(e){var t;e.page=n,t=e,isFinite(t.width)&&isFinite(t.height)&&t.width&&t.height&&(m.zoom=t.zoom,t.page._paper.setSize(t.width,t.height),t.page._paper.canvas.style.width=t.width,t.page._paper.canvas.style.height=t.height,t.page._paper.forEach(function(e){if(e&&e.transform&&!e.grip){void 0!==e._linewidth&&e.attr("stroke-width",e._linewidth*m.zoom);var t=e.attr("clip-rect");"object"==typeof t&&"number"==typeof t.length&&e.attr("clip-rect",t)}}),L(t.page))}}),!0}return!1},a.removeDrawingSurface=function(e){return e instanceof pn&&(e._paper&&(e._paper._annos=null,e._paper._page=null,e._paper=null),e._matrix=null,!(e._grips=null))},a.insertLayer=T,a.removeLayer=C,a.moveLayer=M,a.showLayer=I,a.getAnnotationById=H,a.clear=U,a.createAnnotation=Z,a.deleteAnnoOnPage=G,a.drawAnnotation=he,a.getAnnosFromPage=J,a.setStamps=$,a.setAnnotationDefaults=K,a.setImages=ee,a.setCustom=te,a.dispose=function(){p=g=f=d=s=l=x=h=a=null,m.annos.length=0,m.annoIdsCreated.length=0,m.annoIdsModified.length=0,m.annoIdsRemoved.length=0,m.activepage=null,m.activeanno=null,m.zoom=null,c.dispose(),c=null},
|
|
1378
1378
|
/**
|
|
1379
1379
|
* [Internal] Gets debug info object
|
|
1380
1380
|
* @returns debug info object if available, otherwise null
|
|
1381
1381
|
*/
|
|
1382
|
-
a.__getDebugInfo=function(){var e={};return pn.extend(!0,e,{data:m,defaults:b,drawing:y,drawready:_,matrix:v,menu:f,menuconfig:g,pages:s,props:p,viewport:
|
|
1382
|
+
a.__getDebugInfo=function(){var e={};return pn.extend(!0,e,{data:m,defaults:b,drawing:y,drawready:_,matrix:v,menu:f,menuconfig:g,pages:s,props:p,viewport:d}),e}
|
|
1383
1383
|
/**
|
|
1384
1384
|
* [Internal] Links the annotation data between two controls
|
|
1385
1385
|
* @param linker internal object of type __LVlinker
|
|
@@ -1387,7 +1387,7 @@ a.__getDebugInfo=function(){var e={};return pn.extend(!0,e,{data:m,defaults:b,dr
|
|
|
1387
1387
|
*/,a.__linkAnnotations=function(e){e&&(e._annos?pn.isArray(e._annos)&&(m.annos=e._annos):e._annos=m.annos)}
|
|
1388
1388
|
/**
|
|
1389
1389
|
* [Internal] Clears all selection of annotations
|
|
1390
|
-
*/,a.__clearAllSelection=re,a.setViewPort=function(e){e&&(e instanceof pn||(e=pn(e)),h=e)};var fe=function(){},ge=function(){};function pe(){if(_){h.off("mousedown",ve),mn.Features.Touch&&h.off("touchstart",ve);for(var e=0;e<s.length;e++)s[e]._draw.reset();_=!1}}function ve(e){y=!0,h.off("mousedown",ve),mn.Features.Touch&&h.off("touchstart",ve),m.activeanno.get().isresizing=!0,m.activeanno.getClonedData().isresizing=!0;var t=m.activeanno.getClonedData();d.trigger({type:"annotationdrawstart",annotation:t,ann:t}),m.activeanno._pageindex=m.activepage._index,m.activeanno.startDraw(e,m.activepage._paper,{},d.config.textannomobilezoom)}function me(){ye(),function(e){var t=m.activepage,n=t?t._index:0,o=e.get().annotationId;o&&0!==o&&!de(o)||(o=le()+1,e.setAnnotationId(o)),m.maxAnnotationId<o&&(m.maxAnnotationId=o),e.setFIndex(n),ce(o),m.annos[n]?m.annos[n].push(e):m.annos[n]=[e],m.activeanno.unbind({drawn:me,cancelled:be}),_e(m.activeanno),c.select(m.activeanno,t,!1),fe({annotation:e}),fe=function(){};var i=e.getClonedData();d.trigger({type:w.annocreate,anno:i,annotation:i,page:n})}(m.activeanno),m.activeanno.get().isresizing=!1,m.activeanno.getClonedData().isresizing=!1,(!m.activeanno.get().originalWidth||!m.activeanno.get().originalHeight)&&1<m.activeanno.get().width&&1<m.activeanno.get().height&&(m.activeanno.get().originalWidth=m.activeanno.get().width,m.activeanno.getClonedData().originalWidth=m.activeanno.get().width,m.activeanno.get().originalHeight=m.activeanno.get().height,m.activeanno.getClonedData().originalHeight=m.activeanno.get().height)}function be(){m.activeanno.dispose(),m.activeanno=null,y&&ye(!0)}function xe(){_&&(y?be():(m.activeanno&&(m.activeanno.dispose(),m.activeanno=null),pe()),ge({annotation:null}),ge=function(){})}function ye(e){y=!1,pe();var t=e?null:m.activeanno.getClonedData();d.trigger({type:"annotationdrawend",annotation:t,ann:t,cancelled:!!e})}function _e(o){function e(e){var t=o.getClonedData();d.trigger({type:w[e.type],anno:t,annotation:t})}o.bind({dragstart:function(){var e=o.getClonedData();d.trigger({type:"annotationdragstart",ann:e,annotation:e})},dragend:function(){var e=o.getClonedData();d.trigger({type:"annotationdragend",annotation:e,ann:e})},interactstart:function(){m.activepage&&m.activepage._paper===o.getObject().paper||A(o.getObject().paper._page),m.activeanno=o},annotationchanged:function(e){var t=o.get();t&&t.annotationId&&function(e){if(e&&!(0<=m.annoIdsCreated.indexOf(e))){m.annoIdsModified.indexOf(e)<0&&m.annoIdsModified.push(e);var t=m.annoIdsRemoved.indexOf(e);0<=t&&m.annoIdsRemoved.splice(t,1)}}(t.annotationId);var n=o.getClonedData();d.trigger({type:"annotationchanged",annotation:n,anno:n,annobefore:e.annobefore})},selected:we,deselected:we,reselected:we,contextmenu:R,serverrenderurlrequested:ze,moved:e,rotated:e,annoresized:e,interactend:e,touchstart:e,touchmove:e,pinchmove:e,click:e,dblclick:e,rightclick:e,mousedown:e,mousedownleft:e,mousedownright:e,mouseup:e,mousemove:e,mouseover:e,repaint:e,annotationtextchanged:e,annotationtextchangefailed:function(){d.trigger({type:"throwerror",name:"updateAnnotation",msg:"Failed to change annotation text, because it is already edited by UI."})}})}function we(e){var t=e.page||0<=e.pageindex?e.pageindex:m.activepage,n=c.resolvePage(t);n&&(t=n),"selected"===e.type||"reselected"===e.type?(m.activeanno=e.ann,c.select(e.ann,t,e.append),p&&p.isVisible()&&p.show(e.ann)):(c.deselect(e.ann,t,e.append),p&&p.isVisible()&&p.cancel()),n&&n._grips&&n._grips.repaint()}function ze(e){var t=e.complete,n=De(e.data);"function"==typeof t&&t.call(n)}function ke(e,t){var n=[];for(var o in m.annos)if(m.annos.hasOwnProperty(o)){var i=!e||!t;i||(i=e<=o&&o<=t),i&&(n[o]={items:[]},Te(o,n[o].items))}return JSON.stringify(n)}function Pe(e,t,n,o,i){if((!n||!o||!i)&&(n=0,o=x.getPageScale(t),i=vn.matrix(),x._config.persistrotation&&(!n||!i))){n=x.getPageRotation(t);var a=1/o;(i=x.getViewerTransform(t)).scale(a,a,0,0),i.e*=a,i.f*=a}var r=pn.extend(!0,{},e.get());if(r.rotation||n){var l=e.getBox(),s=l.width/2,c=l.height/2,u=vn.matrix(),d=e.getTransform();u.add(i.a,i.b,i.c,i.d,i.e,i.f),u.add(d.a,d.b,d.c,d.d,d.e,d.f);var h=u.x(l.x+s,l.y+c),f=u.y(l.x+s,l.y+c),g=h-s-l.x,p=f-c-l.y;if(r.points)for(var v=0;v<r.points.length;v++)if("line"===r.type){var m=u.x(r.points[v].x,r.points[v].y);r.points[v].y=u.y(r.points[v].x,r.points[v].y),r.points[v].x=m}else r.points[v].x+=g,r.points[v].y+=p;else"custom"!==r.type&&r.points||(r.x+=g,r.y+=p);r.rotation="line"!==r.type?(r.rotation+n)%360:0}"text"===r.type&&(r.text.value=r.text.value.replace("<","<"),r.text.value=r.text.value.replace(">",">"));var b=Object.assign({},r);return b.originalWidth&&b.originalHeight&&(b.width=b.originalWidth,b.height=b.originalHeight),Ce(r),Ce(b),b}function Te(e,t){var n=0,o=x.getPageScale(e),i=vn.matrix();if(x._config.persistrotation){n=x.getPageRotation(e);var a=1/o;(i=x.getViewerTransform(e)).scale(a,a,0,0),i.e*=a,i.f*=a}for(var r in m.annos[e])m.annos[e].hasOwnProperty(r)&&(t[r]=Pe(m.annos[e][r],e,n,o,i))}function De(e){return Ce(e),JSON.stringify(e)}function Ce(e){for(var t in e)if("color"===t&&null!=e[t]){var n=vn.getRGB(e[t]);n.error&&(n.hex="#000000"),e[t]=n.hex}else"points"!==t&&"object"==typeof e[t]&&Ce(e[t])}function Me(e,t,n,o,i){var a={type:"annodata",serverurl:e,query:"?atalaanndata=",method:"GET",data:{atala_annurl:t,atala_docurl:n=n||d.config.documenturl,atala_a_ofs:o,atala_a_len:i},cancel:!1,info:{layers:[],offset:o||0,length:i,error:void 0}};for(var r in a.data)a.data.hasOwnProperty(r)&&null===a.data[r]&&(a.data[r]=void 0);return a}function Ee(a,r,l){function e(e){if(void 0!==a.info.docIndex&&(e.offset=a.info.docIndex),!e.layers&&e.error&&r)for(var t=e.offset;t<e.offset+a.info.length;t++){if(m.annos[t])for(var n=m.annos[t].length,o=0;o<n;o++){var i=m.annos[t][o].get();i&&ue(i.annotationId)}m.annos[t]=[]}Se(e),"function"==typeof l&&l.call(void 0,e.error,e)}"function"==typeof r&&(l=r,r=!1),r||U(),x.makeHandlerRequest(a,e,e)}function Se(e){if(e){var t={type:"annotationsloaded",customData:e.customData};if(e.layers){for(var n=0;n<e.layers.length;n++){e.offset=e.offset||0;var o=e.offset+n;if(m.annos[o]&&0<m.annos[o].length){for(var i=m.annos[o].length,a=0;a<i;a++){var r=m.annos[o][a].get();r&&ue(r.annotationId)}m.annos[o].length=0}else m.annos[o]=[];var l=e.layers[n];if(l&&(l._index=isFinite(l._index)&&0<=l._index?l._index:o,l.visible=void 0===l.visible||l.visible,l.items))for(var s=0;s<l.items.length;s++){l.items[s].visible=l.items[s].visible&&l.visible,m.annos[o][s]=new Oe(d,l.items[s],m),m.annos[o][s]._pageindex=l._index,m.annos[o][s].setFIndex(l._index);var c=l.items[s].annotationId;c&&0!==c&&!de(c)||(c=le()+1),m.annos[o][s].setAnnotationId(c),m.maxAnnotationId<c&&(m.maxAnnotationId=c);var u=m.annos[o][s].getClonedData();d.trigger({type:w.annoload,anno:u,annotation:u,customData:e.customData}),_e(m.annos[o][s])}}D()}else e.error&&(t.error=e.error);t.offset=e.offset,t.length=e.layers?e.layers.length:0,d.trigger(t)}}function Ie(e){var t;return e.type="stamp",e.text&&((t=e.text)&&t.font&&t.font.size&&(t.font.size=parseFloat(t.font.size)),e.text.readonly=!0),e}a.stringifyChanges=ke,a.stringifyAnnotationData=De,a.createHandlerRequest=Me,a.makeHandlerRequest=Ee,a.loadAnnotationsUrl=function(e,t,n,o,i,a,r){var l=Array.prototype.slice.call(arguments);"function"!=typeof(r=l.pop())&&l.push(r),e=l.shift(),t=l.shift(),n=l.shift(),o=l.shift(),i=l.shift(),a=l.shift();var s=Me(e,t,n,o,i);void 0!==a&&(s.info.docIndex=a),Ee(s,0<=o&&1<=i,r)},a.loadAnnotations=Se};n(120),n(121),n(124);function H(e,t,n){return{x:e.x(t,n),y:e.y(t,n)}}var R,j,G=function(e,t,n){var o,f=t,u=this,i=pn({}),a=null,g=null,r=null,p=n,b={type:"",backgroundcolor:"",color:null,fieldname:"",hidden:!1,isfieldrequired:!1,items:null,locked:!1,norotate:!1,noview:!1,nozoom:!1,readonly:!1,required:!1,x:0,y:0,width:0,height:0,rotation:0,border:{color:"#000",style:"none",radius:{vertical:0,horizontal:0},width:0},text:{value:null,align:"left",font:{bold:!1,italic:!1,strike:!1,underline:!1,color:"black",family:"Arial",size:12,paddingtop:0,linespacing:0},ismultiline:!1,ispassword:!1,isrichtext:!1,scrollable:!1,maxlength:0,maximumfieldheight:-1,preserveoverflow:!1}},l={button:{},checkbox:{checked:!1,group:null},radio:{checked:!1,group:null},textbox:{text:{leftPadding:2,rightPadding:2,preserveoverflow:!1}},signature:{text:{leftPadding:2,rightPadding:2,preserveoverflow:!1}},choice:{multiline:!1}},s={};function c(){return i.trigger.apply(i,arguments),u}function d(e,t){e&&(t?pn.extend(!0,b,e):pn.extend(b,e))}function h(){r={update:function(){pn.extend(!0,b,r),b.update&&delete b.update,D(),T(),null!==a&&(!b.readonly&&b.selectable?(s.isBound("selectable")||(i.on(s.selectable),s.bound("selectable")),b.readonly||!b.movable||s.isBound("movable")?!b.readonly&&b.movable||!s.isBound("movable")||(i.off(s.movable),s.unbound("movable")):(i.on(s.movable),s.bound("movable")),mn.Features.Touch&&(b.readonly||!b.resizable||s.isBound("resizable")?!b.readonly&&b.resizable||!s.isBound("resizable")||(i.off(s.resizable),s.unbound("resizable")):(i.on(s.resizable),s.bound("resizable")))):!b.readonly&&b.selectable||!s.isBound("selectable")||(i.off(s.selectable),s.unbound("selectable"),i.off(s.movable),s.unbound("movable"),i.off(s.resizable),s.unbound("resizable")))}},pn.extend(!0,r,b)}function v(){return JSON.stringify(b)}function m(e,t){return t-(e.value.slice(0,t).split("\r\n").length-1)}function x(e,t){if("number"==typeof e.selectionStart&&"number"==typeof e.selectionEnd)e.selectionStart=t.start,e.selectionEnd=t.end;else{var n=e.createTextRange(),o=m(e,t.start);n.collapse(!0),t.start===t.end?n.move("character",o):(n.moveEnd("character",m(e,t.end)),n.moveStart("character",o)),n.select()}}function y(e){var t=null,m=!1;switch(b.type){case"button":(t=pn("<button/>")).click(function(){return c({type:"buttonclicked",name:b.fieldname}),!1});break;case"textbox":case"signature":t=b.text.multiline?pn("<textarea/>").css("overflow-y",b.text.scrollable?"auto":"hidden").css("resize","none"):pn('<input type="text" />'),b.text.value=t.val(b.text.value).val(),t.on("paste",function(){return m=!0}),t.on("input",function(e){-1===b.text.maximumfieldheight&&(b.text.maximumfieldheight=pn(this).get(0).scrollHeight);var t,n,o,i,a,r,l,s,c=0<b.text.maxlength&&pn(this).val().length>b.text.maxlength,u=!b.text.scrollable&&pn(this).get(0).scrollHeight>b.text.maximumfieldheight;if(pn(this).val().length>b.text.value.length&&(c||u)){var d=(t=e.target,s=l=0,"number"==typeof t.selectionStart&&"number"==typeof t.selectionEnd?(l=t.selectionStart,s=t.selectionEnd):(o=document.selection.createRange())&&o.parentElement()===t&&(a=t.value.length,n=t.value.replace(/\r\n/g,"\n"),(i=t.createTextRange()).moveToBookmark(o.getBookmark()),(r=t.createTextRange()).collapse(!1),-1<i.compareEndPoints("StartToEnd",r)?l=s=a:(l=-i.moveStart("character",-a),l+=n.slice(0,l).split("\n").length-1,-1<i.compareEndPoints("EndToEnd",r)?s=a:(s=-i.moveEnd("character",-a),s+=n.slice(0,s).split("\n").length-1))),{start:l,end:s});if(m&&0<b.text.maxlength){var h=pn(this).val();if(h.length===d.start)pn(this).val(h.substr(0,b.text.maxlength));else{var f=h.length-b.text.value.length,g=b.text.maxlength-b.text.value.length,p=h.substr(0,d.start-f+g),v=b.text.value.substr(d.start-f);pn(this).val(p+v),x(e.target,{start:p.length,end:p.length})}}else pn(this).val(b.text.value),x(e.target,{start:d.start-1,end:d.start-1})}!b.text.preserveoverflow&&pn(this).get(0).scrollHeight<b.text.maximumfieldheight&&(b.text.maximumfieldheight=pn(this).get(0).scrollHeight),b.text.value=pn(this).val(),m=!1});break;case"checkbox":(t=pn('<input type="checkbox" />').prop({name:b.group,checked:b.checked})).val(b.value);break;case"radio":(t=pn('<input type="radio" />').prop({name:b.group,checked:b.checked})).val(b.value);break;case"choice":if((t=pn("<select></select>")).text(b.value),t.attr({multiple:b.multiple,size:b.multiline&&b.items?b.items.length:0}),b.items)for(var n in t.items=[],b.items)if(b.items.hasOwnProperty(n)){var o=pn("<option></option>",{selected:b.items[n].checked,value:b.items[n].value,text:b.items[n].text});t.append(o),t.items[n]=o}if(b.multiline&&b.items){var i=function(){pn(this).trigger("change")};t.on({mouseup:i,touchend:i})}break;case"generic":t=pn("<div></div>")}if(t){if("textbox"===b.type||"signature"===b.type){var a=b.text.font.paddingtop,r=0<b.text.font.linespacing?b.text.font.linespacing+"px":"1.14pt";t.css({resize:"none",position:"absolute",paddingTop:b.multiline?a:0,paddingBottom:b.multiline?"2pt":0,lineHeight:r,margin:0,"-webkit-box-sizing":"border-box","-moz-box-sizing":"border-box","box-sizing":"border-box"})}else t.css({resize:"none",position:"absolute",padding:0,margin:0,"-webkit-box-sizing":"border-box","-moz-box-sizing":"border-box","box-sizing":"border-box"});t.on({click:E,mousedown:E,mouseup:E,change:w,uncheck:z,focusin:k,focusout:P,touchstart:E,touchend:E})}return e._fields&&e._fields.push(t),e.append(t),t}function _(){var e=b.fieldname.lastIndexOf(".");return 0<=e?b.fieldname.substr(0,e):null}function w(e){var t=_(),n=[];switch(b.type){case"button":break;case"textbox":case"signature":if(b.text.value=this.value,f.multiviewFields.hasOwnProperty(t)){var o=f.multiviewFields[t];for(var i in o)if(o.hasOwnProperty(i)){var a=o[i];a!==u&&(a.get().text.value=this.value,a.updateView())}}break;case"checkbox":b.checked=this.checked,b.group&&b.checked&&(pn('input[name="'+b.group+'"]').trigger("uncheck"),b.checked=!0,this.checked=!0);break;case"radio":b.group&&pn('input[name="'+b.group+'"]').trigger("uncheck"),b.checked=this.checked;break;case"choice":if(void 0!==e.target.selectedOptions)n=e.target.selectedOptions;else if(e.target.multiple)for(var r=0;r<e.target.options.length;r++)e.target.options[r].selected&&n.push(e.target.options[r]);else 0<=e.target.selectedIndex&&n.push(e.target.options[e.target.selectedIndex]);for(var l in b.items)if(b.items.hasOwnProperty(l)){var s=b.items[l];for(var c in s.checked=!1,n)n.hasOwnProperty(c)&&n[c].value===s.value&&(s.checked=!0)}}}function z(e){"checkbox"===e.target.type&&(e.target.checked=!1),b.checked=!1}function k(){C(!0),c({type:"fieldfocusin",field:u})}function P(){C(!1),c({type:"fieldfocusout",field:u})}function T(e){e&&"object"==typeof e&&((g=y(e)).zoom=M,D(),c({type:"viewchanged",fieldview:g})),c("repaint")}function D(){if(g){if(b.hidden||b.noview)return void g.hide();g.show();var e=pn.extend({},(t=f.getViewerTransform(p),n=H(t,b.x,b.y),o=H(t,b.x+b.width,b.y+b.height),i=f.getZoom(p),a=b.width*i,r=b.height*i,l={x:(n.x+o.x-a)/2,y:(n.y+o.y-r)/2},s=f.getPageRotation(p)+b.rotation,c="rotate("+s+"deg)",u={left:Math.round(l.x)+"px",top:Math.round(l.y)+"px",width:a+"px",height:r+"px","max-width":a+"px","max-height":r+"px"},d=Dn(0!==s?c:""),pn.extend(u,d),("textbox"===b.type||"signature"===b.type)&&(u.cursor=s%180==0?"text":"vertical-text"),u.visibility="visible",u),(h=b.border&&"underline"===b.border.style,{backgroundColor:b.backgroundcolor,color:b.color||b.text.font.color,borderStyle:b.border&&b.border.style&&!h?b.border.style:"none",borderBottomStyle:h?"solid":"inherit",borderColor:b.border?b.border.color:null,fontFamily:b.text.font.family,fontStyle:b.text.font.italic?"italic":b.text.font.oblique?"oblique":"normal",fontWeight:b.text.font.bold?"bold":"",textAlign:b.text.align}));g.css(e),f.highlighted?(g.addClass("atala-ui-form-highlight"),b.required?g.addClass("atala-ui-form-required"):g.removeClass("atala-ui-form-required")):g.removeClass("atala-ui-form-highlight"),b.readonly?g.attr("readonly","readonly"):g.removeAttr("readonly"),"textbox"===b.type?C(g.is(":focus")):"button"===b.type&&g.text(b.text.value)}var t,n,o,i,a,r,l,s,c,u,d,h}function C(e){"textbox"===b.type&&(e||(b.text.value?g.val()!==b.text.value&&g.val(b.text.value):g.val(b.text.defaultvalue)))}function M(e){e=e||f.getZoom(p),g.css({fontSize:Math.round((b.text.font.size||12)*e*(f.dpi/96)),borderWidth:b.border?Math.round(b.border.width*e):0}),b.text&&b.text.align&&g.css({paddingLeft:b.text.leftPadding*e+"px",paddingRight:b.text.rightPadding*e+"px"}),D()}return u._pageindex=n,o=e.type,pn.extend(!0,b,l[o]),d(e,!0),u.dispose=function(){i&&i.off(),b=i=u=f=null},u.bind=function(){i.on.apply(i,arguments)},u.unbind=function(){i.off.apply(i,arguments)},u.trigger=c,u.set=d,u.get=function(e){return e?b[e]:b},u.setPageIndex=function(e){p=e,u.hasOwnProperty("_pageindex")&&(u._pageindex=e)},u.getClonedData=function(){return r?pn.extend(!0,r,b):h(),r},u.getObject=function(){return g},u.getEventObject=function(){return i},u.getZoom=function(){return f.zoom},u.stringify=v,u.getJSON=v,u.getParentName=_,u.getName=function(){var e=b.fieldname.lastIndexOf(".");return 0<=e?b.fieldname.substr(e+1):b.fieldname},u.repaint=T,u.updateView=D,u.zoom=M,u},On=function e(t,n,o){var i=this,s=t,a=n,r={forms:{events:{
|
|
1390
|
+
*/,a.__clearAllSelection=re,a.setViewPort=function(e){e&&(e instanceof pn||(e=pn(e)),d=e)};var fe=function(){},ge=function(){};function pe(){if(_){d.off("mousedown",ve),mn.Features.Touch&&d.off("touchstart",ve);for(var e=0;e<s.length;e++)s[e]._draw.reset();_=!1}}function ve(e){y=!0,d.off("mousedown",ve),mn.Features.Touch&&d.off("touchstart",ve),m.activeanno.get().isresizing=!0,m.activeanno.getClonedData().isresizing=!0;var t=m.activeanno.getClonedData();h.trigger({type:"annotationdrawstart",annotation:t,ann:t}),m.activeanno._pageindex=m.activepage._index,m.activeanno.startDraw(e,m.activepage._paper,{},h.config.textannomobilezoom)}function me(){ye(),function(e){var t=m.activepage,n=t?t._index:0,o=e.get().annotationId;o&&0!==o&&!de(o)||(o=le()+1,e.setAnnotationId(o)),m.maxAnnotationId<o&&(m.maxAnnotationId=o),e.setFIndex(n),ce(o),m.annos[n]?m.annos[n].push(e):m.annos[n]=[e],m.activeanno.unbind({drawn:me,cancelled:be}),_e(m.activeanno),c.select(m.activeanno,t,!1),fe({annotation:e}),fe=function(){};var i=e.getClonedData();h.trigger({type:w.annocreate,anno:i,annotation:i,page:n})}(m.activeanno),m.activeanno.get().isresizing=!1,m.activeanno.getClonedData().isresizing=!1,(!m.activeanno.get().originalWidth||!m.activeanno.get().originalHeight)&&1<m.activeanno.get().width&&1<m.activeanno.get().height&&(m.activeanno.get().originalWidth=m.activeanno.get().width,m.activeanno.getClonedData().originalWidth=m.activeanno.get().width,m.activeanno.get().originalHeight=m.activeanno.get().height,m.activeanno.getClonedData().originalHeight=m.activeanno.get().height)}function be(){m.activeanno.dispose(),m.activeanno=null,y&&ye(!0)}function xe(){_&&(y?be():(m.activeanno&&(m.activeanno.dispose(),m.activeanno=null),pe()),ge({annotation:null}),ge=function(){})}function ye(e){y=!1,pe();var t=e?null:m.activeanno.getClonedData();h.trigger({type:"annotationdrawend",annotation:t,ann:t,cancelled:!!e})}function _e(o){function e(e){var t=o.getClonedData();h.trigger({type:w[e.type],anno:t,annotation:t})}o.bind({dragstart:function(){var e=o.getClonedData();h.trigger({type:"annotationdragstart",ann:e,annotation:e})},dragend:function(){var e=o.getClonedData();h.trigger({type:"annotationdragend",annotation:e,ann:e})},interactstart:function(){m.activepage&&m.activepage._paper===o.getObject().paper||A(o.getObject().paper._page),m.activeanno=o},annotationchanged:function(e){var t=o.get();t&&t.annotationId&&function(e){if(e&&!(0<=m.annoIdsCreated.indexOf(e))){m.annoIdsModified.indexOf(e)<0&&m.annoIdsModified.push(e);var t=m.annoIdsRemoved.indexOf(e);0<=t&&m.annoIdsRemoved.splice(t,1)}}(t.annotationId);var n=o.getClonedData();h.trigger({type:"annotationchanged",annotation:n,anno:n,annobefore:e.annobefore})},selected:we,deselected:we,reselected:we,contextmenu:R,serverrenderurlrequested:ze,moved:e,rotated:e,annoresized:e,interactend:e,touchstart:e,touchmove:e,pinchmove:e,click:e,dblclick:e,rightclick:e,mousedown:e,mousedownleft:e,mousedownright:e,mouseup:e,mousemove:e,mouseover:e,repaint:e,annotationtextchanged:e,annotationtextchangefailed:function(){h.trigger({type:"throwerror",name:"updateAnnotation",msg:"Failed to change annotation text, because it is already edited by UI."})}})}function we(e){var t=e.page||0<=e.pageindex?e.pageindex:m.activepage,n=c.resolvePage(t);n&&(t=n),"selected"===e.type||"reselected"===e.type?(m.activeanno=e.ann,c.select(e.ann,t,e.append),p&&p.isVisible()&&p.show(e.ann)):(c.deselect(e.ann,t,e.append),p&&p.isVisible()&&p.cancel()),n&&n._grips&&n._grips.repaint()}function ze(e){var t=e.complete,n=De(e.data);"function"==typeof t&&t.call(n)}function ke(e,t){var n=[];for(var o in m.annos)if(m.annos.hasOwnProperty(o)){var i=!e||!t;i||(i=e<=o&&o<=t),i&&(n[o]={items:[]},Te(o,n[o].items))}return JSON.stringify(n)}function Pe(e,t,n,o,i){if((!n||!o||!i)&&(n=0,o=x.getPageScale(t),i=vn.matrix(),x._config.persistrotation&&(!n||!i))){n=x.getPageRotation(t);var a=1/o;(i=x.getViewerTransform(t)).scale(a,a,0,0),i.e*=a,i.f*=a}var r=pn.extend(!0,{},e.get());if(r.rotation||n){var l=e.getBox(),s=l.width/2,c=l.height/2,u=vn.matrix(),d=e.getTransform();u.add(i.a,i.b,i.c,i.d,i.e,i.f),u.add(d.a,d.b,d.c,d.d,d.e,d.f);var h=u.x(l.x+s,l.y+c),f=u.y(l.x+s,l.y+c),g=h-s-l.x,p=f-c-l.y;if(r.points)for(var v=0;v<r.points.length;v++)if("line"===r.type){var m=u.x(r.points[v].x,r.points[v].y);r.points[v].y=u.y(r.points[v].x,r.points[v].y),r.points[v].x=m}else r.points[v].x+=g,r.points[v].y+=p;else"custom"!==r.type&&r.points||(r.x+=g,r.y+=p);r.rotation="line"!==r.type?(r.rotation+n)%360:0}"text"===r.type&&(r.text.value=r.text.value.replace("<","<"),r.text.value=r.text.value.replace(">",">"));var b=Object.assign({},r);return b.originalWidth&&b.originalHeight&&(b.width=b.originalWidth,b.height=b.originalHeight),Ce(r),Ce(b),b}function Te(e,t){var n=0,o=x.getPageScale(e),i=vn.matrix();if(x._config.persistrotation){n=x.getPageRotation(e);var a=1/o;(i=x.getViewerTransform(e)).scale(a,a,0,0),i.e*=a,i.f*=a}for(var r in m.annos[e])m.annos[e].hasOwnProperty(r)&&(t[r]=Pe(m.annos[e][r],e,n,o,i))}function De(e){return Ce(e),JSON.stringify(e)}function Ce(e){for(var t in e)if("color"===t&&null!=e[t]){var n=vn.getRGB(e[t]);n.error&&(n.hex="#000000"),e[t]=n.hex}else"points"!==t&&"object"==typeof e[t]&&Ce(e[t])}function Me(e,t,n,o,i){var a={type:"annodata",serverurl:e,query:"?atalaanndata=",method:"GET",data:{atala_annurl:t,atala_docurl:n=n||h.config.documenturl,atala_a_ofs:o,atala_a_len:i},cancel:!1,info:{layers:[],offset:o||0,length:i,error:void 0}};for(var r in a.data)a.data.hasOwnProperty(r)&&null===a.data[r]&&(a.data[r]=void 0);return a}function Ee(a,r,l){function e(e){if(void 0!==a.info.docIndex&&(e.offset=a.info.docIndex),!e.layers&&e.error&&r)for(var t=e.offset;t<e.offset+a.info.length;t++){if(m.annos[t])for(var n=m.annos[t].length,o=0;o<n;o++){var i=m.annos[t][o].get();i&&ue(i.annotationId)}m.annos[t]=[]}Se(e),"function"==typeof l&&l.call(void 0,e.error,e)}"function"==typeof r&&(l=r,r=!1),r||U(),x.makeHandlerRequest(a,e,e)}function Se(e){if(e){var t={type:"annotationsloaded",customData:e.customData};if(e.layers){for(var n=0;n<e.layers.length;n++){e.offset=e.offset||0;var o=e.offset+n;if(m.annos[o]&&0<m.annos[o].length){for(var i=m.annos[o].length,a=0;a<i;a++){var r=m.annos[o][a].get();r&&ue(r.annotationId)}m.annos[o].length=0}else m.annos[o]=[];var l=e.layers[n];if(l&&(l._index=isFinite(l._index)&&0<=l._index?l._index:o,l.visible=void 0===l.visible||l.visible,l.items))for(var s=0;s<l.items.length;s++){var c=l.items[s].annotationId,u=de(c);l.items[s].visible=l.items[s].visible&&l.visible,m.annos[o][s]=new Oe(h,l.items[s],m),m.annos[o][s]._pageindex=l._index,m.annos[o][s].setFIndex(l._index),c&&0!==c&&!u||(c=le()+1),m.annos[o][s].setAnnotationId(c),m.maxAnnotationId<c&&(m.maxAnnotationId=c);var d=m.annos[o][s].getClonedData();h.trigger({type:w.annoload,anno:d,annotation:d,customData:e.customData}),_e(m.annos[o][s])}}D()}else e.error&&(t.error=e.error);t.offset=e.offset,t.length=e.layers?e.layers.length:0,h.trigger(t)}}function Ie(e){var t;return e.type="stamp",e.text&&((t=e.text)&&t.font&&t.font.size&&(t.font.size=parseFloat(t.font.size)),e.text.readonly=!0),e}a.stringifyChanges=ke,a.stringifyAnnotationData=De,a.createHandlerRequest=Me,a.makeHandlerRequest=Ee,a.loadAnnotationsUrl=function(e,t,n,o,i,a,r){var l=Array.prototype.slice.call(arguments);"function"!=typeof(r=l.pop())&&l.push(r),e=l.shift(),t=l.shift(),n=l.shift(),o=l.shift(),i=l.shift(),a=l.shift();var s=Me(e,t,n,o,i);void 0!==a&&(s.info.docIndex=a),Ee(s,0<=o&&1<=i,r)},a.loadAnnotations=Se};n(120),n(121),n(124);function H(e,t,n){return{x:e.x(t,n),y:e.y(t,n)}}var R,j,G=function(e,t,n){var o,f=t,u=this,i=pn({}),a=null,g=null,r=null,p=n,b={type:"",backgroundcolor:"",color:null,fieldname:"",hidden:!1,isfieldrequired:!1,items:null,locked:!1,norotate:!1,noview:!1,nozoom:!1,readonly:!1,required:!1,x:0,y:0,width:0,height:0,rotation:0,border:{color:"#000",style:"none",radius:{vertical:0,horizontal:0},width:0},text:{value:null,align:"left",font:{bold:!1,italic:!1,strike:!1,underline:!1,color:"black",family:"Arial",size:12,paddingtop:0,linespacing:0},ismultiline:!1,ispassword:!1,isrichtext:!1,scrollable:!1,maxlength:0,maximumfieldheight:-1,preserveoverflow:!1}},l={button:{},checkbox:{checked:!1,group:null},radio:{checked:!1,group:null},textbox:{text:{leftPadding:2,rightPadding:2,preserveoverflow:!1}},signature:{text:{leftPadding:2,rightPadding:2,preserveoverflow:!1}},choice:{multiline:!1}},s={};function c(){return i.trigger.apply(i,arguments),u}function d(e,t){e&&(t?pn.extend(!0,b,e):pn.extend(b,e))}function h(){r={update:function(){pn.extend(!0,b,r),b.update&&delete b.update,D(),T(),null!==a&&(!b.readonly&&b.selectable?(s.isBound("selectable")||(i.on(s.selectable),s.bound("selectable")),b.readonly||!b.movable||s.isBound("movable")?!b.readonly&&b.movable||!s.isBound("movable")||(i.off(s.movable),s.unbound("movable")):(i.on(s.movable),s.bound("movable")),mn.Features.Touch&&(b.readonly||!b.resizable||s.isBound("resizable")?!b.readonly&&b.resizable||!s.isBound("resizable")||(i.off(s.resizable),s.unbound("resizable")):(i.on(s.resizable),s.bound("resizable")))):!b.readonly&&b.selectable||!s.isBound("selectable")||(i.off(s.selectable),s.unbound("selectable"),i.off(s.movable),s.unbound("movable"),i.off(s.resizable),s.unbound("resizable")))}},pn.extend(!0,r,b)}function v(){return JSON.stringify(b)}function m(e,t){return t-(e.value.slice(0,t).split("\r\n").length-1)}function x(e,t){if("number"==typeof e.selectionStart&&"number"==typeof e.selectionEnd)e.selectionStart=t.start,e.selectionEnd=t.end;else{var n=e.createTextRange(),o=m(e,t.start);n.collapse(!0),t.start===t.end?n.move("character",o):(n.moveEnd("character",m(e,t.end)),n.moveStart("character",o)),n.select()}}function y(e){var t=null,m=!1;switch(b.type){case"button":(t=pn("<button/>")).click(function(){return c({type:"buttonclicked",name:b.fieldname}),!1});break;case"textbox":case"signature":t=b.text.multiline?pn("<textarea/>").css("overflow-y",b.text.scrollable?"auto":"hidden").css("resize","none"):pn('<input type="text" />'),b.text.value=t.val(b.text.value).val(),t.on("paste",function(){return m=!0}),t.on("input",function(e){-1===b.text.maximumfieldheight&&(b.text.maximumfieldheight=pn(this).get(0).scrollHeight);var t,n,o,i,a,r,l,s,c=0<b.text.maxlength&&pn(this).val().length>b.text.maxlength,u=!b.text.scrollable&&pn(this).get(0).scrollHeight>b.text.maximumfieldheight;if(pn(this).val().length>b.text.value.length&&(c||u)){var d=(t=e.target,s=l=0,"number"==typeof t.selectionStart&&"number"==typeof t.selectionEnd?(l=t.selectionStart,s=t.selectionEnd):(o=document.selection.createRange())&&o.parentElement()===t&&(a=t.value.length,n=t.value.replace(/\r\n/g,"\n"),(i=t.createTextRange()).moveToBookmark(o.getBookmark()),(r=t.createTextRange()).collapse(!1),-1<i.compareEndPoints("StartToEnd",r)?l=s=a:(l=-i.moveStart("character",-a),l+=n.slice(0,l).split("\n").length-1,-1<i.compareEndPoints("EndToEnd",r)?s=a:(s=-i.moveEnd("character",-a),s+=n.slice(0,s).split("\n").length-1))),{start:l,end:s});if(m&&0<b.text.maxlength){var h=pn(this).val();if(h.length===d.start)pn(this).val(h.substr(0,b.text.maxlength));else{var f=h.length-b.text.value.length,g=b.text.maxlength-b.text.value.length,p=h.substr(0,d.start-f+g),v=b.text.value.substr(d.start-f);pn(this).val(p+v),x(e.target,{start:p.length,end:p.length})}}else pn(this).val(b.text.value),x(e.target,{start:d.start-1,end:d.start-1})}!b.text.preserveoverflow&&pn(this).get(0).scrollHeight<b.text.maximumfieldheight&&(b.text.maximumfieldheight=pn(this).get(0).scrollHeight),b.text.value=pn(this).val(),m=!1});break;case"checkbox":(t=pn('<input type="checkbox" />').prop({name:b.group,checked:b.checked})).val(b.value);break;case"radio":(t=pn('<input type="radio" />').prop({name:b.group,checked:b.checked})).val(b.value);break;case"choice":if((t=pn("<select></select>")).text(b.value),t.attr({multiple:b.multiple,size:b.multiline&&b.items?b.items.length:0}),b.items)for(var n in t.items=[],b.items)if(b.items.hasOwnProperty(n)){var o=pn("<option></option>",{selected:b.items[n].checked,value:b.items[n].value,text:b.items[n].text});t.append(o),t.items[n]=o}if(b.multiline&&b.items){var i=function(){pn(this).trigger("change")};t.on({mouseup:i,touchend:i})}break;case"generic":t=pn("<div></div>")}if(t){if("textbox"===b.type||"signature"===b.type){var a=b.text.font.paddingtop,r=0<b.text.font.linespacing?b.text.font.linespacing+"px":"1.14pt";t.css({resize:"none",position:"absolute",paddingTop:b.multiline?a:0,paddingBottom:b.multiline?"2pt":0,lineHeight:r,margin:0,"-webkit-box-sizing":"border-box","-moz-box-sizing":"border-box","box-sizing":"border-box"})}else t.css({resize:"none",position:"absolute",padding:0,margin:0,"-webkit-box-sizing":"border-box","-moz-box-sizing":"border-box","box-sizing":"border-box"});t.on({click:E,mousedown:E,mouseup:E,change:w,uncheck:z,focusin:k,focusout:P,touchstart:E,touchend:E})}return e._fields&&e._fields.push(t),e.append(t),t}function _(){var e=b.fieldname.lastIndexOf(".");return 0<=e?b.fieldname.substr(0,e):null}function w(e){var t=_(),n=[];switch(b.type){case"button":break;case"textbox":case"signature":if(b.text.value=this.value,f.multiviewFields.hasOwnProperty(t)){var o=f.multiviewFields[t];for(var i in o)if(o.hasOwnProperty(i)){var a=o[i];a!==u&&(a.get().text.value=this.value,a.updateView())}}break;case"checkbox":b.checked=this.checked,b.group&&b.checked&&(pn('input[name="'+b.group+'"]').trigger("uncheck"),b.checked=!0,this.checked=!0);break;case"radio":b.group&&pn('input[name="'+b.group+'"]').trigger("uncheck"),b.checked=this.checked;break;case"choice":if(void 0!==e.target.selectedOptions)n=e.target.selectedOptions;else if(e.target.multiple)for(var r=0;r<e.target.options.length;r++)e.target.options[r].selected&&n.push(e.target.options[r]);else 0<=e.target.selectedIndex&&n.push(e.target.options[e.target.selectedIndex]);for(var l in b.items)if(b.items.hasOwnProperty(l)){var s=b.items[l];for(var c in s.checked=!1,n)n.hasOwnProperty(c)&&n[c].value===s.value&&(s.checked=!0)}}}function z(e){"checkbox"===e.target.type&&(e.target.checked=!1),b.checked=!1}function k(){C(!0),c({type:"fieldfocusin",field:u})}function P(){C(!1),c({type:"fieldfocusout",field:u})}function T(e){e&&"object"==typeof e&&((g=y(e)).zoom=M,D(),c({type:"viewchanged",fieldview:g})),c("repaint")}function D(){if(g){if(b.hidden||b.noview)return void g.hide();g.show();var e=pn.extend({},(t=f.getViewerTransform(p),n=H(t,b.x,b.y),o=H(t,b.x+b.width,b.y+b.height),i=f.getZoom(p),a=b.width*i,r=b.height*i,l={x:(n.x+o.x-a)/2,y:(n.y+o.y-r)/2},s=f.getPageRotation(p)+b.rotation,c="rotate("+s+"deg)",u={left:Math.round(l.x)+"px",top:Math.round(l.y)+"px",width:a+"px",height:r+"px","max-width":a+"px","max-height":r+"px"},d=Dn(0!==s?c:""),pn.extend(u,d),("textbox"===b.type||"signature"===b.type)&&(u.cursor=s%180==0?"text":"vertical-text"),u.visibility="visible",u),(h=b.border&&"underline"===b.border.style,{backgroundColor:b.backgroundcolor,color:b.color||b.text.font.color,borderStyle:b.border&&b.border.style&&!h?b.border.style:"none",borderBottomStyle:h?"solid":"inherit",borderColor:b.border?b.border.color:null,fontFamily:b.text.font.family,fontStyle:b.text.font.italic?"italic":b.text.font.oblique?"oblique":"normal",fontWeight:b.text.font.bold?"bold":"",textAlign:b.text.align}));g.css(e),f.highlighted?(g.addClass("atala-ui-form-highlight"),b.required?g.addClass("atala-ui-form-required"):g.removeClass("atala-ui-form-required")):g.removeClass("atala-ui-form-highlight"),b.readonly?g.attr("readonly","readonly"):g.removeAttr("readonly"),"textbox"===b.type?C(g.is(":focus")):"button"===b.type&&g.text(b.text.value)}var t,n,o,i,a,r,l,s,c,u,d,h}function C(e){"textbox"===b.type&&(e||(b.text.value?g.val()!==b.text.value&&g.val(b.text.value):g.val(b.text.defaultvalue)))}function M(e){e=e||f.getZoom(p),g.css({fontSize:Math.round((b.text.font.size||12)*e*(f.dpi/96)),borderWidth:b.border?Math.round(b.border.width*e):0}),b.text&&b.text.align&&g.css({paddingLeft:b.text.leftPadding*e+"px",paddingRight:b.text.rightPadding*e+"px"}),D()}return u._pageindex=n,o=e.type,pn.extend(!0,b,l[o]),d(e,!0),u.dispose=function(){i&&i.off(),b=i=u=f=null},u.bind=function(){i.on.apply(i,arguments)},u.unbind=function(){i.off.apply(i,arguments)},u.trigger=c,u.set=d,u.get=function(e){return e?b[e]:b},u.setPageIndex=function(e){p=e,u.hasOwnProperty("_pageindex")&&(u._pageindex=e)},u.getClonedData=function(){return r?pn.extend(!0,r,b):h(),r},u.getObject=function(){return g},u.getEventObject=function(){return i},u.getZoom=function(){return f.zoom},u.stringify=v,u.getJSON=v,u.getParentName=_,u.getName=function(){var e=b.fieldname.lastIndexOf(".");return 0<=e?b.fieldname.substr(e+1):b.fieldname},u.repaint=T,u.updateView=D,u.zoom=M,u},On=function e(t,n,o){var i=this,s=t,a=n,r={forms:{events:{
|
|
1391
1391
|
/** Triggers when the user uses the mouse to click on a field. Populated keys: e.field */
|
|
1392
1392
|
fieldclicked:null,
|
|
1393
1393
|
/** Triggers when the user uses the mouse to create a field. Populated keys: e.field */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "web-document-viewer",
|
|
3
|
-
"version": "11.5.
|
|
3
|
+
"version": "11.5.3",
|
|
4
4
|
"description": "Atalasoft JavaScript library for presenting images and documents, including PDF Forms, on a web page.",
|
|
5
5
|
"main": "atalaWebDocumentViewer.js",
|
|
6
6
|
"types:":"atalaWebDocumentViewer.d.ts",
|