Commit d8019ba3f1bcb1798ff17a4f20bfd7c4b900e4cf
1 parent
72862bd9
Commit changes for the Common code.... Now all the common code is being extract…
…ed in home controller.
Showing
3 changed files
with
984 additions
and
984 deletions
400-SOURCECODE/AIAHTML5.Web/app/controllers/CIController.js
... | ... | @@ -534,7 +534,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout |
534 | 534 | theme: 'success', |
535 | 535 | currentController: 'CIController', |
536 | 536 | parentSlug: 'clinical-illustrations', |
537 | - content: '<div class="row"><div style="align:left;width:100%;height:100%"><canvas id="canvas" ng-click="BindCanvasDrawingListnerForCI($event)" width="1369" height="325" class="canvas-annotationStyle" style="position: absolute; background-color: transparent;z-index:1 "></canvas></div> <canvas id="canvasPaint" ng-click="FreeStylePaint($event)" width="1369" height="325" class="canvas-annotationStyle1" style="position: absolute;z-index:0;"></canvas>' + | |
537 | + content: '<div class="row"><div style="align:left;width:100%;height:100%"><canvas id="canvas" ng-click="BindCanvasDrawingListners($event)" width="1369" height="325" class="canvas-annotationStyle" style="position: absolute; background-color: transparent;z-index:1 "></canvas></div> <canvas id="canvasPaint" ng-click="FreeStylePaint($event)" width="1369" height="325" class="canvas-annotationStyle1" style="position: absolute;z-index:0;"></canvas>' + | |
538 | 538 | '<div class="col-sm-12 img-thumbnail" align="center">' + |
539 | 539 | '<img src="' + $scope.clickedCIImage + '" alt="" title="" class="img-responsive "><div class="col-sm-12 well">' + |
540 | 540 | '<div align="left" id="sid"><p>' + $scope.clickedCISummary + '</p></div><button id="btnTxtOnOff" class="btn btn-primary pull-right">Text Off</button>' + |
... | ... | @@ -579,206 +579,21 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout |
579 | 579 | $('#CIView').css("width", $(window).outerWidth()); |
580 | 580 | |
581 | 581 | } |
582 | - //khushbu | |
582 | + | |
583 | 583 | $scope.$on('annotationToolEvent', function (event, data) { |
584 | + | |
585 | + $('#editstylebackgroundcolor .minicolors >.minicolors-swatch > .minicolors-swatch-color').css("background-color", "rgb(255,255,255)") | |
586 | + $('#editstylebackgroundcolor .minicolors >.minicolors-panel > .minicolors-grid >.minicolors-picker').css({ "top": "145px", "left": "4px" }); | |
587 | + $('#outlineColor .minicolors >.minicolors-swatch > .minicolors-swatch-color').css("background-color", "rgb(0,0,0)") | |
588 | + $('#outlineColor .minicolors >.minicolors-panel > .minicolors-grid >.minicolors-picker').css({ "top": "145px", "left": "4px" }); | |
589 | + | |
584 | 590 | $("#canvas").css("display", "block"); |
585 | 591 | $("#canvasPaint").css("display", "block"); |
586 | 592 | |
587 | - $scope.BindCanvasDrawingListnerForCI(); | |
593 | + $rootScope.BindCanvasDrawingListners(); | |
588 | 594 | // $rootScope.FreeStylePaint(); |
589 | 595 | }); |
590 | 596 | |
591 | - | |
592 | - $scope.clicked = true; | |
593 | - $scope.offsetX1 = 0; | |
594 | - $scope.offsetY1 = 0; | |
595 | - $scope.x = 0; | |
596 | - $scope.y = 0; | |
597 | - $scope.BindCanvasDrawingListnerForCI = function (event) { | |
598 | - | |
599 | - $scope.clicked = true; | |
600 | - var annotationCanvas = document.getElementById('canvas'); | |
601 | - if (annotationCanvas != null || annotationCanvas != undefined) { | |
602 | - annotationCanvas.addEventListener('mousedown', $scope.OnPaintCanvasMouseDown, false); | |
603 | - annotationCanvas.addEventListener('mouseup', $scope.OnPaintCanvasMouseUp, false); | |
604 | - } | |
605 | - }; | |
606 | - | |
607 | - $scope.mousePressed = false; | |
608 | - $scope.lastX; $scope.lastY; | |
609 | - var ctx; | |
610 | - | |
611 | - $scope.OnPaintCanvasMouseDown = function (event) { | |
612 | - // alert("testing333"); | |
613 | - var canvasElement = document.getElementById("canvas"); | |
614 | - var ctx = canvasElement.getContext("2d"); | |
615 | - | |
616 | - // var x = event.clientX; | |
617 | - // var y = event.clientY; | |
618 | - $scope.offsetX1 = 0; | |
619 | - $scope.offsetY1 = 0; | |
620 | - $scope.offsetX1 = event.offsetX; | |
621 | - $scope.offsetY1 = event.offsetY; | |
622 | - | |
623 | - ctx.clearRect(0, 0, 2277, 3248); | |
624 | - $scope.clicked = true; | |
625 | - } | |
626 | - $rootScope.resetRectCI = 0; | |
627 | - $rootScope.resetLineCI = 0; | |
628 | - $rootScope.resetCircleCI = 0; | |
629 | - $rootScope.resetArrowCI = 0; | |
630 | - $rootScope.resetPinCI = 0; | |
631 | - $rootScope.resetPinArcCI = 0; | |
632 | - $rootScope.ObjectIndexCI = 0; | |
633 | - $rootScope.Object1IndexCI = 0; | |
634 | - $rootScope.Object2IndexCI = 0; | |
635 | - $rootScope.resetTextCI = 0; | |
636 | - $rootScope.resetTextSaveCI = 0; | |
637 | - $rootScope.ObjectIndexSaveCI = 0; | |
638 | - var arrayRect = {}; | |
639 | - | |
640 | - | |
641 | - var storeLine = ''; | |
642 | - $rootScope.canvasLayerNameCollection1CI = []; | |
643 | - $scope.OnPaintCanvasMouseUp = function (event) { | |
644 | - | |
645 | - if (!$scope.clicked) { | |
646 | - return; | |
647 | - } | |
648 | - $scope.clicked = false; | |
649 | - $scope.x = 0; | |
650 | - $scope.y = 0; | |
651 | - $scope.x = parseInt(event.clientX - ($("#canvas").offset().left)); | |
652 | - $scope.y = parseInt(event.clientY - ($("#canvas").offset().top)); | |
653 | - | |
654 | - var canvasElement = document.getElementById("canvas"); | |
655 | - var ctx = canvasElement.getContext("2d"); | |
656 | - | |
657 | - var canvasElement1 = document.getElementById("canvasPaint"); | |
658 | - var ctx1 = canvasElement1.getContext("2d"); | |
659 | - | |
660 | - | |
661 | - switch ($rootScope.shapeType) { | |
662 | - | |
663 | - case "cursor": | |
664 | - // ctx.clearRect(0, 0, 2277, 3248); | |
665 | - ctx.beginPath(); | |
666 | - ctx1.beginPath(); | |
667 | - | |
668 | - | |
669 | - break; | |
670 | - | |
671 | - case "Line": | |
672 | - | |
673 | - $rootScope.resetLineCI = $rootScope.ObjectIndexCI++; | |
674 | - $rootScope.LineFn('#canvas', $rootScope.resetLineCI, $rootScope.shapestyleborderColor, $rootScope.shapestyleborderWidth, $scope.offsetX1, $scope.offsetY1, $scope.x, $scope.y) | |
675 | - | |
676 | - break; | |
677 | - | |
678 | - case "Rectangle": | |
679 | - $rootScope.resetRectCI = $rootScope.ObjectIndexCI++; | |
680 | - $rootScope.RectangleFn('#canvas', $rootScope.resetRectCI, $rootScope.shapestyleFillColor, $rootScope.shapestyleborderColor, $rootScope.shapestyleOpacity, $rootScope.shapestyleborderWidth, $scope.offsetX1, $scope.offsetY1, $scope.x, $scope.y); | |
681 | - | |
682 | - | |
683 | - break; | |
684 | - | |
685 | - case "Circle": | |
686 | - // alert($rootScope.shapestyleborderWidth); | |
687 | - $rootScope.resetCircleCI = $rootScope.ObjectIndexCI++; | |
688 | - | |
689 | - $rootScope.CircleFn('#canvas', $rootScope.resetCircleCI, $rootScope.shapestyleOpacity, $rootScope.shapestyleborderColor, $rootScope.shapestyleborderWidth, $rootScope.shapestyleFillColor, $scope.offsetX1, $scope.offsetY1, $scope.x, $scope.y); | |
690 | - | |
691 | - break; | |
692 | - case "Arrow": | |
693 | - $rootScope.resetArrowCI = $rootScope.ObjectIndexCI++; | |
694 | - $rootScope.ArrowFn('#canvas', $rootScope.resetArrowCI, $rootScope.shapestyleborderColor, $rootScope.shapestyleborderWidth, $scope.offsetX1, $scope.offsetY1, $scope.x, $scope.y); | |
695 | - | |
696 | - break; | |
697 | - case "Pin": | |
698 | - | |
699 | - $rootScope.resetPinCI = $rootScope.Object2IndexCI++; | |
700 | - $rootScope.resetPinArc = $rootScope.Object1IndexCI++; | |
701 | - | |
702 | - $rootScope.PinFn('#canvas', $rootScope.resetPin, $scope.offsetX1, $scope.offsetY1, $scope.x, $scope.y, $rootScope.resetPinArc); | |
703 | - | |
704 | - | |
705 | - break; | |
706 | - case "TextArea": | |
707 | - | |
708 | - break; | |
709 | - | |
710 | - case "DrawPolygon": | |
711 | - | |
712 | - break; | |
713 | - | |
714 | - } | |
715 | - //} | |
716 | - | |
717 | - } | |
718 | - | |
719 | - //-- TextArea functionality of Annotation toolbar | |
720 | - | |
721 | - $rootScope.fontSizesCI; | |
722 | - $rootScope.fontWeightCI; | |
723 | - $rootScope.fontStyleCI; | |
724 | - $rootScope.textAlignmtCI; | |
725 | - $rootScope.fontColorCI; | |
726 | - $rootScope.underlineTextCI; | |
727 | - $rootScope.textAreaCI; | |
728 | - $rootScope.fontFamilyCI; | |
729 | - $rootScope.TextPropertyArrayCI = []; | |
730 | - $rootScope.modifySavedTextCI = []; | |
731 | - $rootScope.TextRectangleArrCI = []; | |
732 | - $rootScope.rectDimensionCI = []; | |
733 | - | |
734 | - | |
735 | - // will refactor this code later | |
736 | - | |
737 | - | |
738 | - | |
739 | - | |
740 | - // deleting text area on close button | |
741 | - $rootScope.closeModal = function () { | |
742 | - if ($rootScope.isTextAreaClosedButtonActiveCI == true) { | |
743 | - $("#canvas").removeLayer('TextArea_' + $rootScope.resetTextCI).drawLayers(); | |
744 | - $("#canvas").removeLayer("TextRect_" + $rootScope.resetTextRectCI).drawLayers(); | |
745 | - } | |
746 | - } | |
747 | - | |
748 | - | |
749 | - $(document).keydown(function (event) { | |
750 | - | |
751 | - | |
752 | - if (event.which == 46) { | |
753 | - | |
754 | - if ($rootScope.shapeTypePinCI == "Pin") { | |
755 | - | |
756 | - | |
757 | - $("#canvas").removeLayer($rootScope.canvasLayerNameCollection[0].pinName).drawLayers(); | |
758 | - $("#canvas").removeLayer($rootScope.canvasLayerNameCollection[0].ArcName).drawLayers(); | |
759 | - $rootScope.shapeTypePin = ""; | |
760 | - | |
761 | - } | |
762 | - else if ($rootScope.shapeTypeTextCI == "textAreaRect") { | |
763 | - | |
764 | - | |
765 | - | |
766 | - $("#canvas").removeLayer($rootScope.canvasLayerNameCollectionCI[0].textareaRectangle).drawLayers(); | |
767 | - $("#canvas").removeLayer($rootScope.canvasLayerNameCollectionCI[0].textareaString).drawLayers(); | |
768 | - $rootScope.shapeTypeTextCI = ""; | |
769 | - | |
770 | - } | |
771 | - else { | |
772 | - | |
773 | - // alert($rootScope.canvasLayerNameCollection); | |
774 | - $("#canvas").removeLayer($rootScope.canvasLayerNameCollection).drawLayers(); | |
775 | - } | |
776 | - | |
777 | - | |
778 | - } | |
779 | - | |
780 | - }); | |
781 | - | |
782 | 597 | }] |
783 | 598 | |
784 | 599 | ... | ... |
400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js
... | ... | @@ -6316,7 +6316,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo |
6316 | 6316 | |
6317 | 6317 | $("#canvas").css("display", "block"); |
6318 | 6318 | $("#canvasPaint").css("display", "block"); |
6319 | - $scope.BindCanvasDrawingListners(); | |
6319 | + $rootScope.BindCanvasDrawingListners(); | |
6320 | 6320 | $rootScope.FreeStylePaint(); |
6321 | 6321 | }); |
6322 | 6322 | $scope.mousePs; |
... | ... | @@ -6327,746 +6327,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo |
6327 | 6327 | } |
6328 | 6328 | |
6329 | 6329 | |
6330 | - $scope.clicked = true; | |
6331 | - $scope.offsetX1 = 0; | |
6332 | - $scope.offsetY1 = 0; | |
6333 | - $scope.x = 0; | |
6334 | - $scope.y = 0; | |
6335 | - $scope.BindCanvasDrawingListners = function (event) { | |
6336 | - | |
6337 | - $scope.clicked = true; | |
6338 | - // OnPaintCanvasMouseDown(event); | |
6339 | - | |
6340 | - var annotationCanvas = document.getElementById('canvas'); | |
6341 | - if (annotationCanvas != null || annotationCanvas != undefined) { | |
6342 | - annotationCanvas.addEventListener('mousedown', $scope.OnPaintCanvasMouseDown, false); | |
6343 | - annotationCanvas.addEventListener('mouseup', $scope.OnPaintCanvasMouseUp, false); | |
6344 | - } | |
6345 | - // alert("doclick"); | |
6346 | - }; | |
6347 | - | |
6348 | - | |
6349 | - | |
6350 | - | |
6351 | - $scope.mousePressed = false; | |
6352 | - $scope.lastX; $scope.lastY; | |
6353 | - var ctx; | |
6354 | - | |
6355 | - $scope.OnPaintCanvasMouseDown = function (event) { | |
6356 | - | |
6357 | - var canvasElement = document.getElementById("canvas"); | |
6358 | - var ctx = canvasElement.getContext("2d"); | |
6359 | - | |
6360 | - // var x = event.clientX; | |
6361 | - // var y = event.clientY; | |
6362 | - $scope.offsetX1 = 0; | |
6363 | - $scope.offsetY1 = 0; | |
6364 | - $scope.offsetX1 = event.offsetX; | |
6365 | - $scope.offsetY1 = event.offsetY; | |
6366 | - | |
6367 | - ctx.clearRect(0, 0, 2277, 3248); | |
6368 | - $scope.clicked = true; | |
6369 | - } | |
6370 | - | |
6371 | - | |
6372 | - $rootScope.resetRect = 0; | |
6373 | - $rootScope.resetLine = 0; | |
6374 | - $rootScope.resetCircle = 0; | |
6375 | - $rootScope.resetArrow = 0; | |
6376 | - $rootScope.resetPin = 0; | |
6377 | - $rootScope.resetPinArc = 0; | |
6378 | - $rootScope.ObjectIndex = 0; | |
6379 | - $rootScope.Object1Index = 0; | |
6380 | - $rootScope.Object2Index = 0; | |
6381 | - $rootScope.resetText = 0; | |
6382 | - $rootScope.resetTextSave = 0; | |
6383 | - $rootScope.ObjectIndexSave = 0; | |
6384 | - | |
6385 | - var arrayRect = {}; | |
6386 | - | |
6387 | - var storeLine = ''; | |
6388 | - //$rootScope.canvasLayerNameCollection1 = []; | |
6389 | - $scope.OnPaintCanvasMouseUp = function (event) { | |
6390 | - | |
6391 | - if (!$scope.clicked) { | |
6392 | - return; | |
6393 | - } | |
6394 | - $scope.clicked = false; | |
6395 | - $scope.x = 0; | |
6396 | - $scope.y = 0; | |
6397 | - $scope.x = parseInt(event.clientX - ($("#canvas").offset().left)); | |
6398 | - $scope.y = parseInt(event.clientY - ($("#canvas").offset().top)); | |
6399 | - | |
6400 | - var canvasElement = document.getElementById("canvas"); | |
6401 | - var ctx = canvasElement.getContext("2d"); | |
6402 | - | |
6403 | - var canvasElement1 = document.getElementById("canvasPaint"); | |
6404 | - var ctx1 = canvasElement1.getContext("2d"); | |
6405 | - | |
6406 | - | |
6407 | - switch ($rootScope.shapeType) { | |
6408 | - | |
6409 | - case "cursor": | |
6410 | - // ctx.clearRect(0, 0, 2277, 3248); | |
6411 | - ctx.beginPath(); | |
6412 | - ctx1.beginPath(); | |
6413 | - | |
6414 | - | |
6415 | - break; | |
6416 | - | |
6417 | - case "Line": | |
6418 | - //$rootScope.canvasLayerNameCollection = []; | |
6419 | - $rootScope.resetLine = $rootScope.ObjectIndex++; | |
6420 | - | |
6421 | - $rootScope.LineFn('#canvas', $rootScope.resetLine, $rootScope.shapestyleborderColor, $rootScope.shapestyleborderWidth, $scope.offsetX1, $scope.offsetY1, $scope.x, $scope.y) | |
6422 | - | |
6423 | - break; | |
6424 | - | |
6425 | - case "Rectangle": | |
6426 | - $rootScope.resetRect = $rootScope.ObjectIndex++; | |
6427 | - $rootScope.RectangleFn('#canvas', $rootScope.resetRect, $rootScope.shapestyleFillColor, $rootScope.shapestyleborderColor, $rootScope.shapestyleOpacity, $rootScope.shapestyleborderWidth, $scope.offsetX1, $scope.offsetY1, $scope.x, $scope.y); | |
6428 | - | |
6429 | - break; | |
6430 | - | |
6431 | - case "Circle": | |
6432 | - // alert($rootScope.shapestyleborderWidth); | |
6433 | - $rootScope.resetCircle = $rootScope.ObjectIndex++; | |
6434 | - | |
6435 | - $rootScope.CircleFn('#canvas', $rootScope.resetCircle, $rootScope.shapestyleOpacity, $rootScope.shapestyleborderColor, $rootScope.shapestyleborderWidth, $rootScope.shapestyleFillColor, $scope.offsetX1, $scope.offsetY1, $scope.x, $scope.y); | |
6436 | - break; | |
6437 | - case "Arrow": | |
6438 | - $rootScope.resetArrow = $rootScope.ObjectIndex++; | |
6439 | - | |
6440 | - $rootScope.ArrowFn('#canvas', $rootScope.resetArrow, $rootScope.shapestyleborderColor, $rootScope.shapestyleborderWidth, $scope.offsetX1, $scope.offsetY1, $scope.x, $scope.y); | |
6441 | - | |
6442 | - // $scope.resetRect += 1; | |
6443 | - break; | |
6444 | - case "Pin": | |
6445 | - $rootScope.resetPin = $rootScope.Object2Index++; | |
6446 | - $rootScope.resetPinArc = $rootScope.Object1Index++; | |
6447 | - $rootScope.PinFn('#canvas', $rootScope.resetPin, $scope.offsetX1, $scope.offsetY1, $scope.x, $scope.y, $rootScope.resetPinArc); | |
6448 | - | |
6449 | - break; | |
6450 | - case "TextArea": | |
6451 | - $rootScope.IsTextAlreadySave = false; | |
6452 | - $("#text_area").val(''); | |
6453 | - // Draw text | |
6454 | - $rootScope.resetTextRect = $rootScope.ObjectIndex++; | |
6455 | - $rootScope.resetText = $rootScope.ObjectIndex++; | |
6456 | - $('#canvas').drawText({ | |
6457 | - layer: true, | |
6458 | - draggable: true, | |
6459 | - // opacity: $rootScope.shapestyleOpacity, | |
6460 | - name: 'TextArea_' + $rootScope.resetText, | |
6461 | - groups: ['TextArea_' + $rootScope.resetText], | |
6462 | - dragGroups: ['TextArea_' + $rootScope.resetText], | |
6463 | - fillStyle: '#36c', | |
6464 | - strokeWidth: 0, | |
6465 | - x: $scope.offsetX1, y: $scope.offsetY1, | |
6466 | - fontSize: '14pt', | |
6467 | - align: "left", | |
6468 | - fontFamily: 'Verdana, sans-serif', | |
6469 | - text: '' | |
6470 | - | |
6471 | - }) | |
6472 | - // Draw rect as wide as the text | |
6473 | - .drawRect({ | |
6474 | - layer: true, | |
6475 | - name: "TextRect_" + $rootScope.resetTextRect, | |
6476 | - dragGroups: ['shapes'], | |
6477 | - opacity: $rootScope.shapestyleOpacity, | |
6478 | - strokeStyle: $rootScope.shapestyleborderColor, | |
6479 | - strokeWidth: $rootScope.shapestyleborderWidth, | |
6480 | - fillStyle: $rootScope.shapestyleFillColor, | |
6481 | - x: $scope.offsetX1, y: $scope.offsetY1, | |
6482 | - width: $scope.x - $scope.offsetX1, | |
6483 | - height: $scope.y - $scope.offsetY1, | |
6484 | - add: function (layer) { | |
6485 | - | |
6486 | - $rootScope.rectDimension.push({ width: layer.width, height: layer.height, x: layer.x, y: layer.y }); | |
6487 | - | |
6488 | - }, | |
6489 | - click: function (layer) { | |
6490 | - | |
6491 | - $rootScope.canvasLayerNameCollection = []; | |
6492 | - $rootScope.canvasLayerNameCollection.push(layer.name); | |
6493 | - $('#canvas').setLayer(layer.name, { | |
6494 | - handle: { | |
6495 | - type: 'rectangle', | |
6496 | - fillStyle: '#fff', | |
6497 | - strokeStyle: '#c33', | |
6498 | - strokeWidth: 2, | |
6499 | - width: 5, height: 5, | |
6500 | - cornerRadius: 3 | |
6501 | - } | |
6502 | - }).drawLayers(); | |
6503 | - | |
6504 | - }, | |
6505 | - dblclick: function (layer) { | |
6506 | - | |
6507 | - | |
6508 | - $rootScope.rectDimension.push({ width: layer.width, height: layer.height, x: layer.x, y: layer.y }); | |
6509 | - $("#annotationTextModal").modal("toggle"); | |
6510 | - | |
6511 | - $("#text_area").val(''); | |
6512 | - $("#text_area").css({ " font-family": "'Verdana, sans-serif'", "font-size": "14px", "font-weight": "normal", "font-style": "normal", "color": "#000", "text-align": "left", "text-decoration": "none" }); | |
6513 | - $("#font-color .minicolors .minicolors-swatch .minicolors-swatch-color").css({ "background-color": "#000000" }); | |
6514 | - // $("#font-color .minicolors .minicolors-swatch .minicolors-swatch-color").addClass("ActiveDefaultColorAnnotation"); | |
6515 | - | |
6516 | - $("#text-italic").removeClass("ActiveFormattingButtonClass"); | |
6517 | - | |
6518 | - $("#text-bold").removeClass("ActiveFormattingButtonClass"); | |
6519 | - | |
6520 | - $("#text-underline").removeClass("ActiveFormattingButtonClass"); | |
6521 | - | |
6522 | - $("#text-left").removeClass("ActiveFormattingButtonClass"); | |
6523 | - | |
6524 | - $("#text-right").removeClass("ActiveFormattingButtonClass"); | |
6525 | - | |
6526 | - $("#text-center").removeClass("ActiveFormattingButtonClass"); | |
6527 | - | |
6528 | - }, | |
6529 | - mouseout: function (layer) { | |
6530 | - $rootScope.canvasLayerNameCollection = []; | |
6531 | - $('#canvas').setLayer(layer.name, { | |
6532 | - handle: { | |
6533 | - type: 'rectangle', | |
6534 | - fillStyle: 'pink', | |
6535 | - strokeStyle: 'yellow', | |
6536 | - strokeWidth: 0, | |
6537 | - width: 0, height: 0, | |
6538 | - cornerRadius: 0 | |
6539 | - } | |
6540 | - | |
6541 | - }).drawLayers(); | |
6542 | - | |
6543 | - }, | |
6544 | - mouseover: function (layer) { | |
6545 | - | |
6546 | - $('#canvas').setLayer(layer.name, { | |
6547 | - handle: { | |
6548 | - type: 'rectangle', | |
6549 | - fillStyle: '#fff', | |
6550 | - strokeStyle: '#c33', | |
6551 | - strokeWidth: 2, | |
6552 | - width: 5, height: 5, | |
6553 | - cornerRadius: 3 | |
6554 | - } | |
6555 | - }).drawLayers(); | |
6556 | - | |
6557 | - } | |
6558 | - }); | |
6559 | - | |
6560 | - | |
6561 | - $("#annotationTextModal").modal("toggle"); | |
6562 | - $('.btnCursor').trigger('click'); | |
6563 | - $("#font-color .minicolors .minicolors-swatch .minicolors-swatch-color").css({ "background-color": "#000000" }); | |
6564 | - // $("#font-color .minicolors .minicolors-swatch .minicolors-swatch-color").addClass("ActiveDefaultColorAnnotation"); | |
6565 | - $("#text_area").val(''); | |
6566 | - | |
6567 | - $("#text_area").css({ " font-family": 'Verdana, sans-serif', "font-size": "14px", "font-weight": "normal", "font-style": "normal", "color": "#000", "text-align": "left", "text-decoration": "none" }); | |
6568 | - | |
6569 | - $("#text-italic").removeClass("ActiveFormattingButtonClass"); | |
6570 | - | |
6571 | - $("#text-bold").removeClass("ActiveFormattingButtonClass"); | |
6572 | - | |
6573 | - $("#text-underline").removeClass("ActiveFormattingButtonClass"); | |
6574 | - | |
6575 | - $("#text-left").removeClass("ActiveFormattingButtonClass"); | |
6576 | - | |
6577 | - $("#text-right").removeClass("ActiveFormattingButtonClass"); | |
6578 | - | |
6579 | - $("#text-center").removeClass("ActiveFormattingButtonClass"); | |
6580 | - | |
6581 | - $(".btn-annotation").removeClass("activebtncolor"); | |
6582 | - | |
6583 | - $('.btnCursor').addClass('activebtncolor'); | |
6584 | - break; | |
6585 | - | |
6586 | - case "DrawPolygon": | |
6587 | - | |
6588 | - break; | |
6589 | - | |
6590 | - } | |
6591 | - //} | |
6592 | - | |
6593 | - } | |
6594 | - | |
6595 | - | |
6596 | - //-- TextArea functionality of Annotation toolbar | |
6597 | - | |
6598 | - $rootScope.fontSizes; | |
6599 | - $rootScope.fontWeight; | |
6600 | - $rootScope.fontStyle; | |
6601 | - $rootScope.textAlignmt; | |
6602 | - $rootScope.fontColor; | |
6603 | - $rootScope.underlineText; | |
6604 | - $rootScope.textArea; | |
6605 | - $rootScope.fontFamily; | |
6606 | - $rootScope.TextPropertyArray = []; | |
6607 | - $rootScope.modifySavedText = []; | |
6608 | - $rootScope.TextRectangleArr = []; | |
6609 | - $rootScope.rectDimension = []; | |
6610 | - | |
6611 | - | |
6612 | - // will refactor this code later | |
6613 | - | |
6614 | - | |
6615 | - $rootScope.saveText = function () { | |
6616 | - | |
6617 | - // this part will work first time when save button will be clicked | |
6618 | - if ($rootScope.IsTextAlreadySave == false) { | |
6619 | - // getting textarea style properties | |
6620 | - $rootScope.fontSizes = $("#text_area").css("font-size"); | |
6621 | - $rootScope.fontWeight = $("#text_area").css("font-weight"); | |
6622 | - $rootScope.fontStyle = $("#text_area").css("font-style"); | |
6623 | - $rootScope.textAlignmt = $("#text_area").css("text-align"); | |
6624 | - $rootScope.fontColor = $("#text_area").css("color"); | |
6625 | - $rootScope.fontFamily = $("#text_area").css("font-family"); | |
6626 | - $rootScope.underlineText = $("#text_area").css("text-decoration"); | |
6627 | - $rootScope.textArea = $("#text_area").val(); | |
6628 | - | |
6629 | - // deleting previous text area | |
6630 | - | |
6631 | - $("#canvas").removeLayer('TextArea_' + $rootScope.resetText).drawLayers(); | |
6632 | - $("#canvas").removeLayer("TextRect_" + $rootScope.resetTextRect).drawLayers(); | |
6633 | - | |
6634 | - // Text After Saving in Rectangle | |
6635 | - $('#canvas').drawText({ | |
6636 | - layer: true, | |
6637 | - draggable: true, | |
6638 | - name: 'TextAreaNew_' + $rootScope.resetText, | |
6639 | - groups: ['TextAreaNew_' + $rootScope.resetText], | |
6640 | - dragGroups: ['TextAreaNew_' + $rootScope.resetText], | |
6641 | - fillStyle: $rootScope.fontColor, | |
6642 | - fontStyle: $rootScope.fontWeight + " " + $rootScope.fontStyle, | |
6643 | - fontSize: $rootScope.fontSizes, | |
6644 | - fontFamily: $rootScope.fontFamily, | |
6645 | - align: $rootScope.textAlignmt, | |
6646 | - strokeWidth: 0, | |
6647 | - text: $rootScope.textArea, | |
6648 | - x: $rootScope.rectDimension[$rootScope.rectDimension.length - 1].x, y: $rootScope.rectDimension[$rootScope.rectDimension.length - 1].y, | |
6649 | - maxWidth: $rootScope.rectDimension[$rootScope.rectDimension.length - 1].width, | |
6650 | - maxHeight: $rootScope.rectDimension[$rootScope.rectDimension.length - 1].height, | |
6651 | - add: function (layer) { | |
6652 | - // alert(layer.maxWidth); | |
6653 | - $rootScope.TextPropertyArray.push({ Text1: '', Align: '', FontColor: '', FontSize: '', FontStyle: '', FontFamily: '' }); | |
6654 | - $rootScope.TextPropertyArray.push({ Text1: layer.text, Align: layer.align, FontColor: layer.fillStyle, FontSize: layer.fontSize, FontStyle: layer.fontStyle, FontFamily: layer.fontFamily, TextDecoration: $rootScope.underlineText }); | |
6655 | - } | |
6656 | - }) | |
6657 | - // Draw rectangle | |
6658 | - .drawRect({ | |
6659 | - name: 'TextArea1_' + $rootScope.resetText, | |
6660 | - layer: true, | |
6661 | - draggable: true, | |
6662 | - groups: ['TextAreaNew_' + $rootScope.resetText], | |
6663 | - dragGroups: ['TextAreaNew_' + $rootScope.resetText], | |
6664 | - opacity: $rootScope.shapestyleOpacity, | |
6665 | - strokeStyle: $rootScope.shapestyleborderColor, | |
6666 | - strokeWidth: $rootScope.shapestyleborderWidth, | |
6667 | - x: $rootScope.rectDimension[$rootScope.rectDimension.length - 1].x, y: $rootScope.rectDimension[$rootScope.rectDimension.length - 1].y, | |
6668 | - width: $rootScope.rectDimension[$rootScope.rectDimension.length - 1].width, | |
6669 | - height: $rootScope.rectDimension[$rootScope.rectDimension.length - 1].height, | |
6670 | - click: function (layer) { | |
6671 | - $rootScope.shapeTypeText = "textAreaRect"; | |
6672 | - | |
6673 | - var layerNameSplit = layer.name; | |
6674 | - var splitedName = layerNameSplit.split("_"); | |
6675 | - var textValName = "TextAreaNew_"; | |
6676 | - var concatinateResult = textValName.concat(splitedName[1]); | |
6677 | - $rootScope.canvasLayerNameCollection = []; | |
6678 | - $rootScope.canvasLayerNameCollection.push({ textareaRectangle: layer.name, textareaString: concatinateResult }); | |
6679 | - $('#canvas').setLayer(layer.name, { | |
6680 | - handle: { | |
6681 | - type: 'rectangle', | |
6682 | - fillStyle: '#fff', | |
6683 | - strokeStyle: '#c33', | |
6684 | - strokeWidth: 2, | |
6685 | - width: 5, height: 5, | |
6686 | - cornerRadius: 3 | |
6687 | - } | |
6688 | - }).drawLayers(); | |
6689 | - }, | |
6690 | - dblclick: function (layer) { | |
6691 | - | |
6692 | - $rootScope.isTextAreaClosedButtonActive = false; | |
6693 | - $rootScope.IsTextAlreadySave = true; | |
6694 | - | |
6695 | - var _rectLayerOnSave = layer.name; | |
6696 | - var _rectLayerOnSaveSplit = _rectLayerOnSave.split("_"); | |
6697 | - var TextAreaRectName = "TextAreaNew_"; | |
6698 | - var TextAreaRectNameConcatenated = TextAreaRectName.concat(_rectLayerOnSaveSplit[1]); | |
6699 | - | |
6700 | - $rootScope.layerNameArr = layer.name; | |
6701 | - $rootScope.rectTextArr = TextAreaRectNameConcatenated; | |
6702 | - // $rootScope.modifySavedText.push({ TextName: '', RectText: ''}); | |
6703 | - // $rootScope.modifySavedText.push({ TextName: layer.name, RectText: TextAreaRectNameConcatenated }); | |
6704 | - | |
6705 | - $rootScope.rectDimension.push({ width: layer.width, height: layer.height, x: layer.x, y: layer.y }); | |
6706 | - var _rectLayerOnSaveSplitInt; | |
6707 | - //if (_rectLayerOnSaveSplit[1] >= 3) | |
6708 | - // _rectLayerOnSaveSplitInt = parseInt(_rectLayerOnSaveSplit[1] - 2); | |
6709 | - //else | |
6710 | - // _rectLayerOnSaveSplitInt = parseInt(_rectLayerOnSaveSplit[1]); | |
6711 | - | |
6712 | - _rectLayerOnSaveSplitInt = parseInt(_rectLayerOnSaveSplit[1]); | |
6713 | - | |
6714 | - var b = $rootScope.TextPropertyArray[_rectLayerOnSaveSplitInt].Text1; | |
6715 | - $("#text_area").val(b); | |
6716 | - var fontStyleProp = $rootScope.TextPropertyArray[_rectLayerOnSaveSplitInt].FontStyle; | |
6717 | - var fontWeightProp = fontStyleProp.split(" "); | |
6718 | - | |
6719 | - $("#text_area").css("font-size", $rootScope.TextPropertyArray[_rectLayerOnSaveSplitInt].FontSize); | |
6720 | - $("#text_area").css("font-weight", fontWeightProp[0]); | |
6721 | - $("#text_area").css("font-style", fontWeightProp[1]); | |
6722 | - $("#text_area").css("text-align", $rootScope.TextPropertyArray[_rectLayerOnSaveSplitInt].Align); | |
6723 | - $("#text_area").css("color", $rootScope.TextPropertyArray[_rectLayerOnSaveSplitInt].FontColor); | |
6724 | - $("#text_area").css("font-family", $rootScope.TextPropertyArray[_rectLayerOnSaveSplitInt].FontFamily); | |
6725 | - $("#text_area").css("text-decoration", $rootScope.TextPropertyArray[_rectLayerOnSaveSplitInt].TextDecoration); | |
6726 | - $("#font-color .minicolors .minicolors-swatch .minicolors-swatch-color").css({ "background-color": $rootScope.TextPropertyArray[_rectLayerOnSaveSplitInt].FontColor }); | |
6727 | - // $(".ActiveDefaultColorAnnotation").css({ "background-color": $rootScope.TextPropertyArray[_rectLayerOnSaveSplitInt].FontColor + "!important" }); | |
6728 | - // $("#font-color .minicolors .minicolors-swatch .minicolors-swatch-color").addClass("ActiveDefaultColorAnnotation"); | |
6729 | - | |
6730 | - | |
6731 | - //adding text text decoration active class in text edit pop-up | |
6732 | - | |
6733 | - if ($rootScope.TextPropertyArray[_rectLayerOnSaveSplitInt].TextDecoration == "underline") { | |
6734 | - | |
6735 | - $("#text-underline").addClass("ActiveFormattingButtonClass"); | |
6736 | - | |
6737 | - } | |
6738 | - | |
6739 | - else { | |
6740 | - | |
6741 | - $("#text-underline").removeClass("ActiveFormattingButtonClass"); | |
6742 | - | |
6743 | - } | |
6744 | - | |
6745 | - | |
6746 | - | |
6747 | - //adding text font weight active class in text edit pop-up | |
6748 | - | |
6749 | - if (fontWeightProp[0] == 700) { | |
6750 | - | |
6751 | - | |
6752 | - | |
6753 | - $("#text-bold").addClass("ActiveFormattingButtonClass"); | |
6754 | - | |
6755 | - } | |
6756 | - | |
6757 | - else { | |
6758 | - | |
6759 | - $("#text-bold").removeClass("ActiveFormattingButtonClass"); | |
6760 | - | |
6761 | - } | |
6762 | - | |
6763 | - //adding text font style active class in text edit pop-up | |
6764 | - | |
6765 | - if (fontWeightProp[1] == "italic") { | |
6766 | - | |
6767 | - | |
6768 | - $("#text-italic").addClass("ActiveFormattingButtonClass"); | |
6769 | - } | |
6770 | - else { | |
6771 | - $("#text-italic").removeClass("ActiveFormattingButtonClass"); | |
6772 | - | |
6773 | - | |
6774 | - } | |
6775 | - | |
6776 | - //adding text alignment active class in text edit pop-up | |
6777 | - | |
6778 | - if ($rootScope.TextPropertyArray[_rectLayerOnSaveSplitInt].Align == "left") { | |
6779 | - | |
6780 | - $("#text-right").removeClass("ActiveFormattingButtonClass"); | |
6781 | - | |
6782 | - $("#text-center").removeClass("ActiveFormattingButtonClass") | |
6783 | - | |
6784 | - $("#text-left").addClass("ActiveFormattingButtonClass"); | |
6785 | - | |
6786 | - } | |
6787 | - | |
6788 | - else if ($rootScope.TextPropertyArray[_rectLayerOnSaveSplitInt].Align == "right") { | |
6789 | - | |
6790 | - | |
6791 | - | |
6792 | - $("#text-center").removeClass("ActiveFormattingButtonClass") | |
6793 | - | |
6794 | - $("#text-left").removeClass("ActiveFormattingButtonClass"); | |
6795 | - | |
6796 | - $("#text-right").addClass("ActiveFormattingButtonClass"); | |
6797 | - | |
6798 | - | |
6799 | - | |
6800 | - } | |
6801 | - | |
6802 | - else if ($rootScope.TextPropertyArray[_rectLayerOnSaveSplitInt].Align == "center") { | |
6803 | - | |
6804 | - $("#text-left").removeClass("ActiveFormattingButtonClass"); | |
6805 | - | |
6806 | - $("#text-right").removeClass("ActiveFormattingButtonClass"); | |
6807 | - | |
6808 | - $("#text-center").addClass("ActiveFormattingButtonClass"); | |
6809 | - | |
6810 | - | |
6811 | - | |
6812 | - } | |
6813 | - | |
6814 | - | |
6815 | - _rectLayerOnSaveSplitInt = ''; b = ''; | |
6816 | - $("#annotationTextModal").modal("toggle"); | |
6817 | - }, | |
6818 | - mouseout: function (layer) { | |
6819 | - $rootScope.canvasLayerNameCollection = []; | |
6820 | - $('#canvas').setLayer(layer.name, { | |
6821 | - handle: { | |
6822 | - type: 'rectangle', | |
6823 | - fillStyle: 'pink', | |
6824 | - strokeStyle: 'yellow', | |
6825 | - strokeWidth: 0, | |
6826 | - width: 0, height: 0, | |
6827 | - cornerRadius: 0 | |
6828 | - } | |
6829 | - }).drawLayers(); | |
6830 | - }, | |
6831 | - mouseover: function (layer) { | |
6832 | - $('#canvas').setLayer(layer.name, { | |
6833 | - handle: { | |
6834 | - type: 'rectangle', | |
6835 | - fillStyle: '#fff', | |
6836 | - strokeStyle: '#c33', | |
6837 | - strokeWidth: 2, | |
6838 | - width: 5, height: 5, | |
6839 | - cornerRadius: 3 | |
6840 | - } | |
6841 | - }).drawLayers(); | |
6842 | - | |
6843 | - } | |
6844 | - }); | |
6845 | - $("#text_area").val(''); | |
6846 | - $("#text_area").css({ " font-family": "'Verdana, sans-serif'", "font-size": "14px", "font-weight": "normal", "font-style": "normal", "color": "#000", "text-align": "left", "text-decoration": "none" }); | |
6847 | - | |
6848 | - $("#font-color .minicolors .minicolors-swatch .minicolors-swatch-color").css({ "background-color": "#000000" }); | |
6849 | - $("#text-italic").removeClass("ActiveFormattingButtonClass"); | |
6850 | - | |
6851 | - $("#text-bold").removeClass("ActiveFormattingButtonClass"); | |
6852 | - | |
6853 | - $("#text-underline").removeClass("ActiveFormattingButtonClass"); | |
6854 | - | |
6855 | - $("#text-left").removeClass("ActiveFormattingButtonClass"); | |
6856 | - | |
6857 | - $("#text-right").removeClass("ActiveFormattingButtonClass"); | |
6858 | - | |
6859 | - $("#text-center").removeClass("ActiveFormattingButtonClass"); | |
6860 | - | |
6861 | - | |
6862 | - } | |
6863 | - | |
6864 | - // this part will work second time when save button will be clicked | |
6865 | - else { | |
6866 | - | |
6867 | - // getting textarea style properties | |
6868 | - var _modifiedText = $("#text_area").val(); | |
6869 | - var _modifiedFontSize = $("#text_area").css("font-size"); | |
6870 | - var _modifiedFontWeight = $("#text_area").css("font-weight"); | |
6871 | - var _modifiedFontStyle = $("#text_area").css("font-style"); | |
6872 | - var _modifiedTextAlign = $("#text_area").css("text-align"); | |
6873 | - var _modifiedFontColor = $("#text_area").css("color"); | |
6874 | - var _modifiedFontFamily = $("#text_area").css("font-family"); | |
6875 | - var _modifiedFontDecoration = $("#text_area").css("text-decoration"); | |
6876 | - | |
6877 | - // deleting previous textarea | |
6878 | - | |
6879 | - // var a = $rootScope.modifySavedTextIndexNumber; | |
6880 | - // alert(a); | |
6881 | - // alert($rootScope.modifySavedText.length); | |
6882 | - // alert($rootScope.modifySavedText[a].RectText); | |
6883 | - | |
6884 | - $("#canvas").removeLayer($rootScope.layerNameArr).drawLayers(); | |
6885 | - $("#canvas").removeLayer($rootScope.rectTextArr).drawLayers(); | |
6886 | - | |
6887 | - $rootScope.resetTextRectSave = $rootScope.ObjectIndexSave++; | |
6888 | - $rootScope.resetTextSave = $rootScope.ObjectIndexSave++; | |
6889 | - | |
6890 | - // generating new text area | |
6891 | - $('#canvas').drawText({ | |
6892 | - layer: true, | |
6893 | - draggable: true, | |
6894 | - name: 'TextAreaAfterEdit_' + $rootScope.resetTextSave, | |
6895 | - groups: ['TextAreaAfterEdit_' + $rootScope.resetTextSave], | |
6896 | - dragGroups: ['TextAreaAfterEdit_' + $rootScope.resetTextSave], | |
6897 | - fillStyle: _modifiedFontColor, | |
6898 | - fontStyle: _modifiedFontWeight + " " + _modifiedFontStyle, | |
6899 | - fontSize: _modifiedFontSize, | |
6900 | - fontFamily: _modifiedFontFamily, | |
6901 | - align: _modifiedTextAlign, | |
6902 | - strokeWidth: 0, | |
6903 | - text: _modifiedText, | |
6904 | - x: $rootScope.rectDimension[$rootScope.rectDimension.length - 1].x, y: $rootScope.rectDimension[$rootScope.rectDimension.length - 1].y, | |
6905 | - maxWidth: $rootScope.rectDimension[$rootScope.rectDimension.length - 1].width, | |
6906 | - maxHeight: $rootScope.rectDimension[$rootScope.rectDimension.length - 1].height | |
6907 | - | |
6908 | - }) | |
6909 | - // Draw rect as wide as the text | |
6910 | - .drawRect({ | |
6911 | - name: 'TextAreaAfterEditRect_' + $rootScope.resetTextSave, | |
6912 | - layer: true, | |
6913 | - draggable: true, | |
6914 | - groups: ['TextAreaAfterEdit_' + $rootScope.resetTextSave], | |
6915 | - dragGroups: ['TextAreaAfterEdit_' + $rootScope.resetTextSave], | |
6916 | - opacity: $rootScope.shapestyleOpacity, | |
6917 | - strokeStyle: $rootScope.shapestyleborderColor, | |
6918 | - strokeWidth: $rootScope.shapestyleborderWidth, | |
6919 | - x: $rootScope.rectDimension[$rootScope.rectDimension.length - 1].x, y: $rootScope.rectDimension[$rootScope.rectDimension.length - 1].y, | |
6920 | - width: $rootScope.rectDimension[$rootScope.rectDimension.length - 1].width, | |
6921 | - height: $rootScope.rectDimension[$rootScope.rectDimension.length - 1].height, | |
6922 | - click: function (layer) { | |
6923 | - $rootScope.shapeTypeText = "textAreaRect"; | |
6924 | - var layerNameSplit = layer.name; | |
6925 | - var splitedName = layerNameSplit.split("_"); | |
6926 | - var textValName = "TextAreaAfterEdit_"; | |
6927 | - var concatinateResult = textValName.concat(splitedName[1]); | |
6928 | - $rootScope.canvasLayerNameCollection = []; | |
6929 | - $rootScope.canvasLayerNameCollection.push({ textareaRectangle: layer.name, textareaString: concatinateResult }); | |
6930 | - | |
6931 | - $('#canvas').setLayer(layer.name, { | |
6932 | - handle: { | |
6933 | - type: 'rectangle', | |
6934 | - fillStyle: '#fff', | |
6935 | - strokeStyle: '#c33', | |
6936 | - strokeWidth: 2, | |
6937 | - width: 5, height: 5, | |
6938 | - cornerRadius: 3 | |
6939 | - } | |
6940 | - }).drawLayers(); | |
6941 | - | |
6942 | - }, | |
6943 | - dblclick: function (layer) { | |
6944 | - | |
6945 | - $rootScope.isTextAreaClosedButtonActive = false; | |
6946 | - $rootScope.IsTextAlreadySave = true; | |
6947 | - var _rectLayerOnSave = layer.name; | |
6948 | - var _rectLayerOnSaveSplit = _rectLayerOnSave.split("_"); | |
6949 | - var RectNameAfterEdit = "TextAreaAfterEdit_"; | |
6950 | - var RectNameAfterEditResult = RectNameAfterEdit.concat(_rectLayerOnSaveSplit[1]); | |
6951 | - $rootScope.modifySavedTextIndexNumber = _rectLayerOnSaveSplit[1]; | |
6952 | - | |
6953 | - | |
6954 | - | |
6955 | - // $rootScope.modifySavedText.push({ TextName: '', RectText: '' }); | |
6956 | - // $rootScope.modifySavedText.push({ TextName: layer.name, RectText: RectNameAfterEditResult }); | |
6957 | - | |
6958 | - $rootScope.layerNameArr = layer.name; | |
6959 | - $rootScope.rectTextArr = RectNameAfterEditResult; | |
6960 | - | |
6961 | - | |
6962 | - $rootScope.rectDimension.push({ width: layer.width, height: layer.height, x: layer.x, y: layer.y }); | |
6963 | - $("#text_area").val(_modifiedText); | |
6964 | - $("#text_area").css("font-size", _modifiedFontSize); | |
6965 | - $("#text_area").css("font-weight", _modifiedFontWeight); | |
6966 | - $("#text_area").css("font-style", _modifiedFontStyle); | |
6967 | - $("#text_area").css("text-align", _modifiedTextAlign); | |
6968 | - $("#text_area").css("color", _modifiedFontColor); | |
6969 | - $("#text_area").css("font-family", _modifiedFontFamily); | |
6970 | - $("#text_area").css("text-decoration", _modifiedFontDecoration); | |
6971 | - $("#font-color .minicolors .minicolors-swatch .minicolors-swatch-color").css({ "background-color": _modifiedFontColor }); | |
6972 | - // $(".ActiveDefaultColorAnnotation").css({ "background-color": _modifiedFontColor + "!important" }); | |
6973 | - // $("#font-color .minicolors .minicolors-swatch .minicolors-swatch-color").addClass("ActiveDefaultColorAnnotation"); | |
6974 | - | |
6975 | - //adding text text decoration active class in text edit pop-up | |
6976 | - if (_modifiedFontDecoration == "underline") { | |
6977 | - $("#text-underline").addClass("ActiveFormattingButtonClass"); | |
6978 | - } | |
6979 | - else { | |
6980 | - $("#text-underline").removeClass("ActiveFormattingButtonClass"); | |
6981 | - } | |
6982 | - | |
6983 | - //adding text font weight active class in text edit pop-up | |
6984 | - if (_modifiedFontWeight == 700) { | |
6985 | - | |
6986 | - $("#text-bold").addClass("ActiveFormattingButtonClass"); | |
6987 | - } | |
6988 | - else { | |
6989 | - | |
6990 | - $("#text-bold").removeClass("ActiveFormattingButtonClass"); | |
6991 | - | |
6992 | - } | |
6993 | - | |
6994 | - //adding text font style active class in text edit pop-up | |
6995 | - if (_modifiedFontStyle == "italic") { | |
6996 | - | |
6997 | - $("#text-italic").addClass("ActiveFormattingButtonClass"); | |
6998 | - } | |
6999 | - else { | |
7000 | - $("#text-italic").removeClass("ActiveFormattingButtonClass"); | |
7001 | - | |
7002 | - } | |
7003 | - | |
7004 | - //adding text alignment active class in text edit pop-up | |
7005 | - if (_modifiedTextAlign == "left") { | |
7006 | - $("#text-right").removeClass("ActiveFormattingButtonClass"); | |
7007 | - $("#text-center").removeClass("ActiveFormattingButtonClass") | |
7008 | - $("#text-left").addClass("ActiveFormattingButtonClass"); | |
7009 | - } | |
7010 | - else if (_modifiedTextAlign == "right") { | |
7011 | - | |
7012 | - $("#text-center").removeClass("ActiveFormattingButtonClass") | |
7013 | - $("#text-left").removeClass("ActiveFormattingButtonClass"); | |
7014 | - $("#text-right").addClass("ActiveFormattingButtonClass"); | |
7015 | - | |
7016 | - } | |
7017 | - else if (_modifiedTextAlign == "center") { | |
7018 | - $("#text-left").removeClass("ActiveFormattingButtonClass"); | |
7019 | - $("#text-right").removeClass("ActiveFormattingButtonClass"); | |
7020 | - $("#text-center").addClass("ActiveFormattingButtonClass"); | |
7021 | - | |
7022 | - } | |
7023 | - | |
7024 | - | |
7025 | - $("#annotationTextModal").modal("toggle"); | |
7026 | - }, | |
7027 | - mouseout: function (layer) { | |
7028 | - $rootScope.canvasLayerNameCollection = []; | |
7029 | - $('#canvas').setLayer(layer.name, { | |
7030 | - handle: { | |
7031 | - type: 'rectangle', | |
7032 | - fillStyle: 'pink', | |
7033 | - strokeStyle: 'yellow', | |
7034 | - strokeWidth: 0, | |
7035 | - width: 0, height: 0, | |
7036 | - cornerRadius: 0 | |
7037 | - } | |
7038 | - }).drawLayers(); | |
7039 | - }, | |
7040 | - mouseover: function (layer) { | |
7041 | - $('#canvas').setLayer(layer.name, { | |
7042 | - handle: { | |
7043 | - type: 'rectangle', | |
7044 | - fillStyle: '#fff', | |
7045 | - strokeStyle: '#c33', | |
7046 | - strokeWidth: 2, | |
7047 | - width: 5, height: 5, | |
7048 | - cornerRadius: 3 | |
7049 | - } | |
7050 | - }).drawLayers(); | |
7051 | - | |
7052 | - } | |
7053 | - }); | |
7054 | - // $rootScope.modifySavedText = []; | |
7055 | - | |
7056 | - } | |
7057 | - } | |
7058 | - | |
7059 | - // deleting text area on close button | |
7060 | - $rootScope.closeModal = function () { | |
7061 | - | |
7062 | - | |
7063 | - if ($rootScope.isTextAreaClosedButtonActive == true) { | |
7064 | - $("#canvas").removeLayer('TextArea_' + $rootScope.resetText).drawLayers(); | |
7065 | - $("#canvas").removeLayer("TextRect_" + $rootScope.resetTextRect).drawLayers(); | |
7066 | - | |
7067 | - } | |
7068 | - | |
7069 | - } | |
7070 | 6330 | |
7071 | 6331 | |
7072 | 6332 | function OnPaintCanvasMouseMove(event) { |
... | ... | @@ -7140,38 +6400,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo |
7140 | 6400 | |
7141 | 6401 | |
7142 | 6402 | |
7143 | - $(document).keydown(function (event) { | |
7144 | - | |
7145 | - // predefined function for detecting keyboard key | |
7146 | - if (event.which == 46) { | |
7147 | - | |
7148 | - if ($rootScope.shapeTypePin == "Pin") { | |
7149 | - | |
7150 | - | |
7151 | - $("#canvas").removeLayer($rootScope.canvasLayerNameCollection[0].pinName).drawLayers(); | |
7152 | - $("#canvas").removeLayer($rootScope.canvasLayerNameCollection[0].ArcName).drawLayers(); | |
7153 | - $rootScope.shapeTypePin = ""; | |
7154 | - | |
7155 | - } | |
7156 | - else if ($rootScope.shapeTypeText == "textAreaRect") { | |
7157 | - | |
7158 | - | |
7159 | - | |
7160 | - $("#canvas").removeLayer($rootScope.canvasLayerNameCollection[0].textareaRectangle).drawLayers(); | |
7161 | - $("#canvas").removeLayer($rootScope.canvasLayerNameCollection[0].textareaString).drawLayers(); | |
7162 | - $rootScope.shapeTypeText = ""; | |
7163 | - | |
7164 | - } | |
7165 | - else { | |
7166 | - | |
7167 | - // alert($rootScope.canvasLayerNameCollection); | |
7168 | - $("#canvas").removeLayer($rootScope.canvasLayerNameCollection).drawLayers(); | |
7169 | - } | |
7170 | - | |
7171 | - | |
7172 | - } | |
7173 | - | |
7174 | - }); | |
6403 | + | |
7175 | 6404 | |
7176 | 6405 | //body highlight options functinality |
7177 | 6406 | $scope.LoadBodySystemData = function () { | ... | ... |
400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js
... | ... | @@ -466,10 +466,10 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", |
466 | 466 | //----End------------- |
467 | 467 | |
468 | 468 | //--Common code of Annotation Toolbar for CI and DA------- |
469 | - $rootScope.LineFn=function(canvasId, resetLine, shapestyleborderColor, shapestyleborderWidth, offsetX1, offsetY1, x, y ) | |
469 | + $rootScope.LineFn = function (canvasId, LineNumber, shapestyleborderColor, shapestyleborderWidth, offsetX1, offsetY1, x, y) | |
470 | 470 | { |
471 | 471 | $(canvasId).addLayer({ |
472 | - name: 'Line_' + resetLine, | |
472 | + name: 'Line_' + LineNumber, | |
473 | 473 | layer: true, |
474 | 474 | type: 'line', |
475 | 475 | draggable: true, |
... | ... | @@ -530,10 +530,10 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", |
530 | 530 | $('.btnCursor').addClass('activebtncolor'); |
531 | 531 | } |
532 | 532 | |
533 | - $rootScope.RectangleFn = function (canvasId, resetRect, shapestyleFillColor, shapestyleborderColor, shapestyleOpacity, shapestyleborderWidth, offsetX1, offsetY1, x,y) { | |
533 | + $rootScope.RectangleFn = function (canvasId, RectNumber, shapestyleFillColor, shapestyleborderColor, shapestyleOpacity, shapestyleborderWidth, offsetX1, offsetY1, x,y) { | |
534 | 534 | $(canvasId).addLayer({ |
535 | 535 | layer: true, |
536 | - name: 'Rect_' + resetRect, | |
536 | + name: 'Rect_' + RectNumber, | |
537 | 537 | fillStyle: shapestyleFillColor, |
538 | 538 | type: 'rectangle', |
539 | 539 | draggable: true, |
... | ... | @@ -606,12 +606,11 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", |
606 | 606 | |
607 | 607 | } |
608 | 608 | |
609 | - | |
610 | - $rootScope.CircleFn = function (canvasId, resetCircle, shapestyleOpacity, shapestyleborderColor, shapestyleborderWidth, shapestyleFillColor, offsetX1, offsetY1,x,y) { | |
609 | + $rootScope.CircleFn = function (canvasId, CircleNumber, shapestyleOpacity, shapestyleborderColor, shapestyleborderWidth, shapestyleFillColor, offsetX1, offsetY1, x, y) { | |
611 | 610 | |
612 | 611 | $(canvasId).addLayer({ |
613 | 612 | layer: true, |
614 | - name: 'Circle_' +resetCircle, | |
613 | + name: 'Circle_' + CircleNumber, | |
615 | 614 | type: 'ellipse', |
616 | 615 | opacity: shapestyleOpacity, |
617 | 616 | draggable: true, |
... | ... | @@ -677,11 +676,11 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", |
677 | 676 | $('.btnCursor').addClass('activebtncolor'); |
678 | 677 | } |
679 | 678 | |
680 | - $rootScope.ArrowFn = function (canvasId, resetArrow, shapestyleborderColor, shapestyleborderWidth, offsetX1, offsetY1,x,y) { | |
679 | + $rootScope.ArrowFn = function (canvasId, ArrowNumber, shapestyleborderColor, shapestyleborderWidth, offsetX1, offsetY1, x, y) { | |
681 | 680 | |
682 | 681 | $('#canvas').drawLine({ |
683 | 682 | layer: true, |
684 | - name: 'Arrow_' + resetArrow, | |
683 | + name: 'Arrow_' + ArrowNumber, | |
685 | 684 | draggable: true, |
686 | 685 | strokeStyle: shapestyleborderColor, |
687 | 686 | strokeWidth: shapestyleborderWidth, |
... | ... | @@ -745,7 +744,7 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", |
745 | 744 | $('.btnCursor').addClass('activebtncolor'); |
746 | 745 | } |
747 | 746 | |
748 | - $rootScope.PinFn = function (canvasId, resetPin, offsetX1, offsetY1, x, y, resetPinArc) { | |
747 | + $rootScope.PinFn = function (canvasId, PinNumber, offsetX1, offsetY1, x, y, PinArcNumber) { | |
749 | 748 | var radial = $('#canvas').createGradient({ |
750 | 749 | x1: 50, y1: 50, |
751 | 750 | x2: 50, y2: 50, |
... | ... | @@ -756,9 +755,9 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", |
756 | 755 | $(canvasId).drawLine({ |
757 | 756 | draggable: true, |
758 | 757 | layer: true, |
759 | - name: "Pin_" + resetPin, | |
760 | - groups: ["Pin_" + resetPin], | |
761 | - dragGroups: ["Pin_" + resetPin], | |
758 | + name: "Pin_" + PinNumber, | |
759 | + groups: ["Pin_" + PinNumber], | |
760 | + dragGroups: ["Pin_" + PinNumber], | |
762 | 761 | strokeStyle: 'black', |
763 | 762 | strokeWidth: 2, |
764 | 763 | x1: offsetX1, y1: offsetY1, |
... | ... | @@ -821,11 +820,11 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", |
821 | 820 | } |
822 | 821 | }).drawArc({ |
823 | 822 | draggable: true, |
824 | - name: "ArcPin_" + resetPinArc, | |
823 | + name: "ArcPin_" + PinArcNumber, | |
825 | 824 | // name: "Pin_" + $rootScope.resetPin, |
826 | 825 | layer: true, |
827 | - groups: ["Pin_" + resetPin], | |
828 | - dragGroups: ["Pin_" + resetPin], | |
826 | + groups: ["Pin_" + PinNumber], | |
827 | + dragGroups: ["Pin_" + PinNumber], | |
829 | 828 | strokeStyle: 'grey', |
830 | 829 | strokeWidth: 2, |
831 | 830 | fillStyle: radial, |
... | ... | @@ -841,7 +840,7 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", |
841 | 840 | |
842 | 841 | add: function (layer) { |
843 | 842 | |
844 | - $rootScope.resetPinArc = layer.name; | |
843 | + $rootScope.PinArcNumber = layer.name; | |
845 | 844 | // $scope.arr = []; |
846 | 845 | |
847 | 846 | |
... | ... | @@ -853,6 +852,963 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", |
853 | 852 | $('.btnCursor').addClass('activebtncolor'); |
854 | 853 | } |
855 | 854 | |
855 | + $rootScope.TextAreaFn = function (canvasId, TextNumber, offsetX1, offsetY1, resetTextRect, shapestyleOpacity, shapestyleborderColor, shapestyleborderWidth, shapestyleFillColor,x,y) { | |
856 | + | |
857 | + | |
858 | + | |
859 | + | |
860 | + $('#canvas').drawText({ | |
861 | + layer: true, | |
862 | + draggable: true, | |
863 | + // opacity: $rootScope.shapestyleOpacity, | |
864 | + name: 'TextArea_' + $rootScope.TextNumber, | |
865 | + groups: ['TextArea_' + $rootScope.TextNumber], | |
866 | + dragGroups: ['TextArea_' + $rootScope.TextNumber], | |
867 | + fillStyle: '#36c', | |
868 | + strokeWidth: 0, | |
869 | + x: $rootScope.offsetX1, y: $rootScope.offsetY1, | |
870 | + fontSize: '14pt', | |
871 | + align: "left", | |
872 | + fontFamily: 'Verdana, sans-serif', | |
873 | + text: '', | |
874 | + add: function (layer) { | |
875 | + | |
876 | + $rootScope.TextID = layer.name; | |
877 | + } | |
878 | + | |
879 | + | |
880 | + }) | |
881 | + // Draw rect as wide as the text | |
882 | + .drawRect({ | |
883 | + layer: true, | |
884 | + name: "TextRect_" + $rootScope.TextNumber, | |
885 | + dragGroups: ['shapes'], | |
886 | + opacity: $rootScope.shapestyleOpacity, | |
887 | + strokeStyle: $rootScope.shapestyleborderColor, | |
888 | + strokeWidth: $rootScope.shapestyleborderWidth, | |
889 | + fillStyle: $rootScope.shapestyleFillColor, | |
890 | + x: $rootScope.offsetX1, y: $rootScope.offsetY1, | |
891 | + width: $rootScope.x - $rootScope.offsetX1, | |
892 | + height: $rootScope.y - $rootScope.offsetY1, | |
893 | + add: function (layer) { | |
894 | + | |
895 | + $rootScope.TextAreaRectID = layer.name; | |
896 | + $rootScope.rectDimension.push({ width: layer.width, height: layer.height, x: layer.x, y: layer.y }); | |
897 | + | |
898 | + }, | |
899 | + click: function (layer) { | |
900 | + | |
901 | + $rootScope.canvasLayerNameCollection = []; | |
902 | + $rootScope.canvasLayerNameCollection.push(layer.name); | |
903 | + $('#canvas').setLayer(layer.name, { | |
904 | + handle: { | |
905 | + type: 'rectangle', | |
906 | + fillStyle: '#fff', | |
907 | + strokeStyle: '#c33', | |
908 | + strokeWidth: 2, | |
909 | + width: 5, height: 5, | |
910 | + cornerRadius: 3 | |
911 | + } | |
912 | + }).drawLayers(); | |
913 | + | |
914 | + }, | |
915 | + dblclick: function (layer) { | |
916 | + | |
917 | + | |
918 | + var RectNameArray = (layer.name).split("_"); | |
919 | + | |
920 | + var TextAreaRectName1 = "TextArea_"; | |
921 | + var TextAreaRectNameConcat = TextAreaRectName1.concat(RectNameArray[1]); | |
922 | + $rootScope.TextAreaRectID = layer.name; | |
923 | + $rootScope.TextID = TextAreaRectNameConcat; | |
924 | + | |
925 | + $rootScope.rectDimension.push({ width: layer.width, height: layer.height, x: layer.x, y: layer.y }); | |
926 | + $("#annotationTextModal").modal("toggle"); | |
927 | + | |
928 | + $("#text_area").val(''); | |
929 | + $("#text_area").css({ " font-family": "'Verdana, sans-serif'", "font-size": "14px", "font-weight": "normal", "font-style": "normal", "color": "#000", "text-align": "left", "text-decoration": "none" }); | |
930 | + $("#font-color .minicolors .minicolors-swatch .minicolors-swatch-color").css({ "background-color": "#000000" }); | |
931 | + // $("#font-color .minicolors .minicolors-swatch .minicolors-swatch-color").addClass("ActiveDefaultColorAnnotation"); | |
932 | + | |
933 | + $("#text-italic").removeClass("ActiveFormattingButtonClass"); | |
934 | + | |
935 | + $("#text-bold").removeClass("ActiveFormattingButtonClass"); | |
936 | + | |
937 | + $("#text-underline").removeClass("ActiveFormattingButtonClass"); | |
938 | + | |
939 | + $("#text-left").removeClass("ActiveFormattingButtonClass"); | |
940 | + | |
941 | + $("#text-right").removeClass("ActiveFormattingButtonClass"); | |
942 | + | |
943 | + $("#text-center").removeClass("ActiveFormattingButtonClass"); | |
944 | + | |
945 | + }, | |
946 | + mouseout: function (layer) { | |
947 | + $rootScope.canvasLayerNameCollection = []; | |
948 | + $('#canvas').setLayer(layer.name, { | |
949 | + handle: { | |
950 | + type: 'rectangle', | |
951 | + fillStyle: 'pink', | |
952 | + strokeStyle: 'yellow', | |
953 | + strokeWidth: 0, | |
954 | + width: 0, height: 0, | |
955 | + cornerRadius: 0 | |
956 | + } | |
957 | + | |
958 | + }).drawLayers(); | |
959 | + | |
960 | + }, | |
961 | + mouseover: function (layer) { | |
962 | + | |
963 | + $('#canvas').setLayer(layer.name, { | |
964 | + handle: { | |
965 | + type: 'rectangle', | |
966 | + fillStyle: '#fff', | |
967 | + strokeStyle: '#c33', | |
968 | + strokeWidth: 2, | |
969 | + width: 5, height: 5, | |
970 | + cornerRadius: 3 | |
971 | + } | |
972 | + }).drawLayers(); | |
973 | + | |
974 | + } | |
975 | + }); | |
976 | + | |
977 | + | |
978 | + $("#annotationTextModal").modal("toggle"); | |
979 | + $('.btnCursor').trigger('click'); | |
980 | + $("#font-color .minicolors .minicolors-swatch .minicolors-swatch-color").css({ "background-color": "#000000" }); | |
981 | + | |
982 | + $("#text_area").val(''); | |
983 | + | |
984 | + $("#text_area").css({ " font-family": 'Verdana, sans-serif', "font-size": "14px", "font-weight": "normal", "font-style": "normal", "color": "#000", "text-align": "left", "text-decoration": "none" }); | |
985 | + | |
986 | + $("#text-italic").removeClass("ActiveFormattingButtonClass"); | |
987 | + | |
988 | + $("#text-bold").removeClass("ActiveFormattingButtonClass"); | |
989 | + | |
990 | + $("#text-underline").removeClass("ActiveFormattingButtonClass"); | |
991 | + | |
992 | + $("#text-left").removeClass("ActiveFormattingButtonClass"); | |
993 | + | |
994 | + $("#text-right").removeClass("ActiveFormattingButtonClass"); | |
995 | + | |
996 | + $("#text-center").removeClass("ActiveFormattingButtonClass"); | |
997 | + | |
998 | + $(".btn-annotation").removeClass("activebtncolor"); | |
999 | + | |
1000 | + $('.btnCursor').addClass('activebtncolor'); | |
1001 | + | |
1002 | + | |
1003 | + //$('#canvas').drawText({ | |
1004 | + // layer: true, | |
1005 | + // draggable: true, | |
1006 | + // // opacity: $rootScope.shapestyleOpacity, | |
1007 | + // name: 'TextArea_' + TextNumber, | |
1008 | + // groups: ['TextArea_' + TextNumber], | |
1009 | + // dragGroups: ['TextArea_' + TextNumber], | |
1010 | + // fillStyle: '#36c', | |
1011 | + // strokeWidth: 0, | |
1012 | + // x: offsetX1, y: offsetY1, | |
1013 | + // fontSize: '14pt', | |
1014 | + // align: "left", | |
1015 | + // fontFamily: 'Verdana, sans-serif', | |
1016 | + // text: '' | |
1017 | + | |
1018 | + //}) | |
1019 | + // // Draw rect as wide as the text | |
1020 | + // .drawRect({ | |
1021 | + // layer: true, | |
1022 | + // name: "TextRect_" + resetTextRect, | |
1023 | + // dragGroups: ['shapes'], | |
1024 | + // opacity: shapestyleOpacity, | |
1025 | + // strokeStyle: shapestyleborderColor, | |
1026 | + // strokeWidth: shapestyleborderWidth, | |
1027 | + // fillStyle: shapestyleFillColor, | |
1028 | + // x: offsetX1, y: offsetY1, | |
1029 | + // width: x - offsetX1, | |
1030 | + // height: y - offsetY1, | |
1031 | + // add: function (layer) { | |
1032 | + | |
1033 | + // $rootScope.rectDimension.push({ width: layer.width, height: layer.height, x: layer.x, y: layer.y }); | |
1034 | + // // $rootScope.rectDimensionCI.push({ width: layer.width, height: layer.height, x: layer.x, y: layer.y }); | |
1035 | + | |
1036 | + // }, | |
1037 | + // click: function (layer) { | |
1038 | + | |
1039 | + // $rootScope.canvasLayerNameCollection = []; | |
1040 | + // $rootScope.canvasLayerNameCollection.push(layer.name); | |
1041 | + // $('#canvas').setLayer(layer.name, { | |
1042 | + // handle: { | |
1043 | + // type: 'rectangle', | |
1044 | + // fillStyle: '#fff', | |
1045 | + // strokeStyle: '#c33', | |
1046 | + // strokeWidth: 2, | |
1047 | + // width: 5, height: 5, | |
1048 | + // cornerRadius: 3 | |
1049 | + // } | |
1050 | + // }).drawLayers(); | |
1051 | + | |
1052 | + // }, | |
1053 | + // dblclick: function (layer) { | |
1054 | + | |
1055 | + // //$rootScope.rectDimensionCI.push({ width: layer.width, height: layer.height, x: layer.x, y: layer.y }); | |
1056 | + // $rootScope.rectDimension.push({ width: layer.width, height: layer.height, x: layer.x, y: layer.y }); | |
1057 | + // $("#annotationTextModal").modal("toggle"); | |
1058 | + | |
1059 | + // $("#text_area").val(''); | |
1060 | + // $("#text_area").css({ " font-family": "'Verdana, sans-serif'", "font-size": "14px", "font-weight": "normal", "font-style": "normal", "color": "#000", "text-align": "left", "text-decoration": "none" }); | |
1061 | + // $("#font-color .minicolors .minicolors-swatch .minicolors-swatch-color").css({ "background-color": "#000000" }); | |
1062 | + // // $("#font-color .minicolors .minicolors-swatch .minicolors-swatch-color").addClass("ActiveDefaultColorAnnotation"); | |
1063 | + | |
1064 | + // $("#text-italic").removeClass("ActiveFormattingButtonClass"); | |
1065 | + | |
1066 | + // $("#text-bold").removeClass("ActiveFormattingButtonClass"); | |
1067 | + | |
1068 | + // $("#text-underline").removeClass("ActiveFormattingButtonClass"); | |
1069 | + | |
1070 | + // $("#text-left").removeClass("ActiveFormattingButtonClass"); | |
1071 | + | |
1072 | + // $("#text-right").removeClass("ActiveFormattingButtonClass"); | |
1073 | + | |
1074 | + // $("#text-center").removeClass("ActiveFormattingButtonClass"); | |
1075 | + | |
1076 | + // }, | |
1077 | + // mouseout: function (layer) { | |
1078 | + // $rootScope.canvasLayerNameCollection = []; | |
1079 | + // $('#canvas').setLayer(layer.name, { | |
1080 | + // handle: { | |
1081 | + // type: 'rectangle', | |
1082 | + // fillStyle: 'pink', | |
1083 | + // strokeStyle: 'yellow', | |
1084 | + // strokeWidth: 0, | |
1085 | + // width: 0, height: 0, | |
1086 | + // cornerRadius: 0 | |
1087 | + // } | |
1088 | + | |
1089 | + // }).drawLayers(); | |
1090 | + | |
1091 | + // }, | |
1092 | + // mouseover: function (layer) { | |
1093 | + | |
1094 | + // $('#canvas').setLayer(layer.name, { | |
1095 | + // handle: { | |
1096 | + // type: 'rectangle', | |
1097 | + // fillStyle: '#fff', | |
1098 | + // strokeStyle: '#c33', | |
1099 | + // strokeWidth: 2, | |
1100 | + // width: 5, height: 5, | |
1101 | + // cornerRadius: 3 | |
1102 | + // } | |
1103 | + // }).drawLayers(); | |
1104 | + | |
1105 | + // } | |
1106 | + // }); | |
1107 | + | |
1108 | + | |
1109 | + //$("#annotationTextModal").modal("toggle"); | |
1110 | + //$('.btnCursor').trigger('click'); | |
1111 | + //$("#font-color .minicolors .minicolors-swatch .minicolors-swatch-color").css({ "background-color": "#000000" }); | |
1112 | + //// $("#font-color .minicolors .minicolors-swatch .minicolors-swatch-color").addClass("ActiveDefaultColorAnnotation"); | |
1113 | + //$("#text_area").val(''); | |
1114 | + | |
1115 | + //$("#text_area").css({ " font-family": 'Verdana, sans-serif', "font-size": "14px", "font-weight": "normal", "font-style": "normal", "color": "#000", "text-align": "left", "text-decoration": "none" }); | |
1116 | + | |
1117 | + //$("#text-italic").removeClass("ActiveFormattingButtonClass"); | |
1118 | + | |
1119 | + //$("#text-bold").removeClass("ActiveFormattingButtonClass"); | |
1120 | + | |
1121 | + //$("#text-underline").removeClass("ActiveFormattingButtonClass"); | |
1122 | + | |
1123 | + //$("#text-left").removeClass("ActiveFormattingButtonClass"); | |
1124 | + | |
1125 | + //$("#text-right").removeClass("ActiveFormattingButtonClass"); | |
1126 | + | |
1127 | + //$("#text-center").removeClass("ActiveFormattingButtonClass"); | |
1128 | + | |
1129 | + //$(".btn-annotation").removeClass("activebtncolor"); | |
1130 | + | |
1131 | + //$('.btnCursor').addClass('activebtncolor'); | |
1132 | + } | |
1133 | + | |
1134 | + | |
1135 | + | |
1136 | + $rootScope.clicked = true; | |
1137 | + $rootScope.offsetX1 = 0; | |
1138 | + $rootScope.offsetY1 = 0; | |
1139 | + $rootScope.x = 0; | |
1140 | + $rootScope.y = 0; | |
1141 | + $rootScope.mousePressed = false; | |
1142 | + $rootScope.lastX; $rootScope.lastY; | |
1143 | + var ctx; | |
1144 | + $rootScope.OnPaintCanvasMouseDown = function (event) { | |
1145 | + | |
1146 | + var canvasElement = document.getElementById("canvas"); | |
1147 | + var ctx = canvasElement.getContext("2d"); | |
1148 | + | |
1149 | + // var x = event.clientX; | |
1150 | + // var y = event.clientY; | |
1151 | + $rootScope.offsetX1 = 0; | |
1152 | + $rootScope.offsetY1 = 0; | |
1153 | + $rootScope.offsetX1 = event.offsetX; | |
1154 | + $rootScope.offsetY1 = event.offsetY; | |
1155 | + | |
1156 | + ctx.clearRect(0, 0, 2277, 3248); | |
1157 | + $rootScope.clicked = true; | |
1158 | + | |
1159 | + // alert("x:"+$rootScope.offsetX1 + " y:" + $rootScope.offsetY1); | |
1160 | + } | |
1161 | + | |
1162 | + $rootScope.rectNumber = 0; | |
1163 | + $rootScope.LineNumber = 0; | |
1164 | + $rootScope.CircleNumber = 0; | |
1165 | + $rootScope.ArrowNumber = 0; | |
1166 | + $rootScope.PinNumber = 0; | |
1167 | + $rootScope.PinArcNumber = 0; | |
1168 | + $rootScope.ObjectIndex = 0; | |
1169 | + $rootScope.Object1Index = 0; | |
1170 | + $rootScope.Object2Index = 0; | |
1171 | + $rootScope.TextNumber = 0; | |
1172 | + $rootScope.resetTextSave = 0; | |
1173 | + $rootScope.ObjectIndexSave = 0; | |
1174 | + | |
1175 | + var arrayRect = {}; | |
1176 | + | |
1177 | + var storeLine = ''; | |
1178 | + //$rootScope.canvasLayerNameCollection1 = []; | |
1179 | + $rootScope.OnPaintCanvasMouseUp = function (event) { | |
1180 | + | |
1181 | + if (!$rootScope.clicked) { | |
1182 | + return; | |
1183 | + } | |
1184 | + $rootScope.clicked = false; | |
1185 | + $rootScope.x = 0; | |
1186 | + $rootScope.y = 0; | |
1187 | + $rootScope.x = parseInt(event.clientX - ($("#canvas").offset().left)); | |
1188 | + $rootScope.y = parseInt(event.clientY - ($("#canvas").offset().top)); | |
1189 | + | |
1190 | + var canvasElement = document.getElementById("canvas"); | |
1191 | + var ctx = canvasElement.getContext("2d"); | |
1192 | + | |
1193 | + var canvasElement1 = document.getElementById("canvasPaint"); | |
1194 | + var ctx1 = canvasElement1.getContext("2d"); | |
1195 | + | |
1196 | + | |
1197 | + switch ($rootScope.shapeType) { | |
1198 | + | |
1199 | + case "cursor": | |
1200 | + // ctx.clearRect(0, 0, 2277, 3248); | |
1201 | + ctx.beginPath(); | |
1202 | + ctx1.beginPath(); | |
1203 | + | |
1204 | + | |
1205 | + break; | |
1206 | + | |
1207 | + case "Line": | |
1208 | + //$rootScope.canvasLayerNameCollection = []; | |
1209 | + $rootScope.LineNumber = $rootScope.ObjectIndex++; | |
1210 | + | |
1211 | + $rootScope.LineFn('#canvas', $rootScope.LineNumber, $rootScope.shapestyleborderColor, $rootScope.shapestyleborderWidth, $rootScope.offsetX1, $rootScope.offsetY1, $rootScope.x, $rootScope.y) | |
1212 | + | |
1213 | + break; | |
1214 | + | |
1215 | + case "Rectangle": | |
1216 | + $rootScope.rectNumber = $rootScope.ObjectIndex++; | |
1217 | + $rootScope.RectangleFn('#canvas', $rootScope.rectNumber, $rootScope.shapestyleFillColor, $rootScope.shapestyleborderColor, $rootScope.shapestyleOpacity, $rootScope.shapestyleborderWidth, $rootScope.offsetX1, $rootScope.offsetY1, $rootScope.x, $rootScope.y); | |
1218 | + | |
1219 | + break; | |
1220 | + | |
1221 | + case "Circle": | |
1222 | + // alert($rootScope.shapestyleborderWidth); | |
1223 | + $rootScope.CircleNumber = $rootScope.ObjectIndex++; | |
1224 | + | |
1225 | + $rootScope.CircleFn('#canvas', $rootScope.CircleNumber, $rootScope.shapestyleOpacity, $rootScope.shapestyleborderColor, $rootScope.shapestyleborderWidth, $rootScope.shapestyleFillColor, $rootScope.offsetX1, $rootScope.offsetY1, $rootScope.x, $rootScope.y); | |
1226 | + break; | |
1227 | + case "Arrow": | |
1228 | + $rootScope.ArrowNumber = $rootScope.ObjectIndex++; | |
1229 | + | |
1230 | + $rootScope.ArrowFn('#canvas', $rootScope.ArrowNumber, $rootScope.shapestyleborderColor, $rootScope.shapestyleborderWidth, $rootScope.offsetX1, $rootScope.offsetY1, $rootScope.x, $rootScope.y); | |
1231 | + | |
1232 | + // $scope.resetRect += 1; | |
1233 | + break; | |
1234 | + case "Pin": | |
1235 | + $rootScope.PinNumber = $rootScope.Object2Index++; | |
1236 | + $rootScope.PinArcNumber = $rootScope.Object1Index++; | |
1237 | + $rootScope.PinFn('#canvas', $rootScope.PinNumber, $rootScope.offsetX1, $rootScope.offsetY1, $rootScope.x, $rootScope.y, $rootScope.PinArcNumber); | |
1238 | + | |
1239 | + break; | |
1240 | + case "TextArea": | |
1241 | + $rootScope.IsTextAlreadySave = false; | |
1242 | + $("#text_area").val(''); | |
1243 | + // Draw text | |
1244 | + $rootScope.resetTextRect = $rootScope.ObjectIndex++; | |
1245 | + $rootScope.TextNumber = $rootScope.ObjectIndex++; | |
1246 | + $rootScope.TextAreaFn('#canvas', $rootScope.TextNumber, $rootScope.offsetX1, $rootScope.offsetY1, $rootScope.resetTextRect, $rootScope.shapestyleOpacity, $rootScope.shapestyleborderColor, $rootScope.shapestyleborderWidth, $rootScope.shapestyleFillColor, $rootScope.x, $rootScope.y); | |
1247 | + break; | |
1248 | + | |
1249 | + case "DrawPolygon": | |
1250 | + | |
1251 | + break; | |
1252 | + | |
1253 | + } | |
1254 | + //} | |
1255 | + | |
1256 | + } | |
1257 | + | |
1258 | + | |
1259 | + $rootScope.fontSizes; | |
1260 | + $rootScope.fontWeight; | |
1261 | + $rootScope.fontStyle; | |
1262 | + $rootScope.textAlignmt; | |
1263 | + $rootScope.fontColor; | |
1264 | + $rootScope.underlineText; | |
1265 | + $rootScope.textArea; | |
1266 | + $rootScope.fontFamily; | |
1267 | + $rootScope.TextPropertyArray = []; | |
1268 | + $rootScope.modifySavedText = []; | |
1269 | + $rootScope.TextRectangleArr = []; | |
1270 | + $rootScope.rectDimension = []; | |
1271 | + | |
1272 | + | |
1273 | + | |
1274 | + ///----- | |
1275 | + | |
1276 | + $rootScope.saveText = function () { | |
1277 | + | |
1278 | + // this part will work first time when save button will be clicked | |
1279 | + if ($rootScope.IsTextAlreadySave == false) { | |
1280 | + // getting textarea style properties | |
1281 | + $rootScope.fontSizes = $("#text_area").css("font-size"); | |
1282 | + $rootScope.fontWeight = $("#text_area").css("font-weight"); | |
1283 | + $rootScope.fontStyle = $("#text_area").css("font-style"); | |
1284 | + $rootScope.textAlignmt = $("#text_area").css("text-align"); | |
1285 | + $rootScope.fontColor = $("#text_area").css("color"); | |
1286 | + $rootScope.fontFamily = $("#text_area").css("font-family"); | |
1287 | + $rootScope.underlineText = $("#text_area").css("text-decoration"); | |
1288 | + $rootScope.textArea = $("#text_area").val(); | |
1289 | + | |
1290 | + // deleting previous text area | |
1291 | + | |
1292 | + | |
1293 | + $("#canvas").removeLayer($rootScope.TextID).drawLayers(); | |
1294 | + $("#canvas").removeLayer($rootScope.TextAreaRectID).drawLayers(); | |
1295 | + | |
1296 | + | |
1297 | + // $("#canvas").removeLayer('TextArea_' + $rootScope.TextNumber).drawLayers(); | |
1298 | + // $("#canvas").removeLayer("TextRect_" + $rootScope.TextNumber).drawLayers(); | |
1299 | + | |
1300 | + // Text After Saving in Rectangle | |
1301 | + $rootScope.resetTextRect = $rootScope.ObjectIndex++; | |
1302 | + $('#canvas').drawText({ | |
1303 | + layer: true, | |
1304 | + draggable: true, | |
1305 | + name: 'TextAreaNew_' + $rootScope.resetTextRect, | |
1306 | + groups: ['TextAreaNew_' + $rootScope.resetTextRect], | |
1307 | + dragGroups: ['TextAreaNew_' + $rootScope.resetTextRect], | |
1308 | + fillStyle: $rootScope.fontColor, | |
1309 | + fontStyle: $rootScope.fontWeight + " " + $rootScope.fontStyle, | |
1310 | + fontSize: $rootScope.fontSizes, | |
1311 | + fontFamily: $rootScope.fontFamily, | |
1312 | + align: $rootScope.textAlignmt, | |
1313 | + strokeWidth: 0, | |
1314 | + text: $rootScope.textArea, | |
1315 | + x: $rootScope.rectDimension[$rootScope.rectDimension.length - 1].x, y: $rootScope.rectDimension[$rootScope.rectDimension.length - 1].y, | |
1316 | + maxWidth: $rootScope.rectDimension[$rootScope.rectDimension.length - 1].width, | |
1317 | + maxHeight: $rootScope.rectDimension[$rootScope.rectDimension.length - 1].height, | |
1318 | + add: function (layer) { | |
1319 | + | |
1320 | + //$rootScope.TextPropertyArray.push({ Text1: '', Align: '', FontColor: '', FontSize: '', FontStyle: '', FontFamily: '' }); | |
1321 | + $rootScope.TextPropertyArray.push({ layerName: layer.name, Text1: layer.text, Align: layer.align, FontColor: layer.fillStyle, FontSize: layer.fontSize, FontStyle: layer.fontStyle, FontFamily: layer.fontFamily, TextDecoration: $rootScope.underlineText }); | |
1322 | + } | |
1323 | + }) | |
1324 | + // Draw rectangle | |
1325 | + .drawRect({ | |
1326 | + name: 'TextArea1_' + $rootScope.resetTextRect, | |
1327 | + layer: true, | |
1328 | + draggable: true, | |
1329 | + groups: ['TextAreaNew_' + $rootScope.resetTextRect], | |
1330 | + dragGroups: ['TextAreaNew_' + $rootScope.resetTextRect], | |
1331 | + opacity: $rootScope.shapestyleOpacity, | |
1332 | + strokeStyle: $rootScope.shapestyleborderColor, | |
1333 | + strokeWidth: $rootScope.shapestyleborderWidth, | |
1334 | + x: $rootScope.rectDimension[$rootScope.rectDimension.length - 1].x, y: $rootScope.rectDimension[$rootScope.rectDimension.length - 1].y, | |
1335 | + width: $rootScope.rectDimension[$rootScope.rectDimension.length - 1].width, | |
1336 | + height: $rootScope.rectDimension[$rootScope.rectDimension.length - 1].height, | |
1337 | + click: function (layer) { | |
1338 | + $rootScope.shapeTypeText = "textAreaRect"; | |
1339 | + | |
1340 | + var layerNameSplit = layer.name; | |
1341 | + var splitedName = layerNameSplit.split("_"); | |
1342 | + var textValName = "TextAreaNew_"; | |
1343 | + var concatinateResult = textValName.concat(splitedName[1]); | |
1344 | + $rootScope.canvasLayerNameCollection = []; | |
1345 | + $rootScope.canvasLayerNameCollection.push({ textareaRectangle: layer.name, textareaString: concatinateResult }); | |
1346 | + $('#canvas').setLayer(layer.name, { | |
1347 | + handle: { | |
1348 | + type: 'rectangle', | |
1349 | + fillStyle: '#fff', | |
1350 | + strokeStyle: '#c33', | |
1351 | + strokeWidth: 2, | |
1352 | + width: 5, height: 5, | |
1353 | + cornerRadius: 3 | |
1354 | + } | |
1355 | + }).drawLayers(); | |
1356 | + }, | |
1357 | + dblclick: function (layer) { | |
1358 | + | |
1359 | + $rootScope.isTextAreaClosedButtonActive = false; | |
1360 | + $rootScope.IsTextAlreadySave = true; | |
1361 | + | |
1362 | + var _rectLayerOnSave = layer.name; | |
1363 | + var _rectLayerOnSaveSplit = _rectLayerOnSave.split("_"); | |
1364 | + var TextAreaRectName = "TextAreaNew_"; | |
1365 | + var TextAreaRectNameConcatenated = TextAreaRectName.concat(_rectLayerOnSaveSplit[1]); | |
1366 | + // alert(TextAreaRectNameConcatenated); | |
1367 | + //if (_rectLayerOnSaveSplit[1]%2 == 0) | |
1368 | + //{ | |
1369 | + // _rectLayerOnSaveSplit[1] = _rectLayerOnSaveSplit[1] - 1; | |
1370 | + | |
1371 | + //} | |
1372 | + //else | |
1373 | + //{ | |
1374 | + | |
1375 | + // _rectLayerOnSaveSplit[1] = _rectLayerOnSaveSplit[1]; | |
1376 | + //} | |
1377 | + | |
1378 | + $rootScope.layerNameArr = layer.name; | |
1379 | + $rootScope.rectTextArr = TextAreaRectNameConcatenated; | |
1380 | + | |
1381 | + | |
1382 | + $rootScope.rectDimension.push({ width: layer.width, height: layer.height, x: layer.x, y: layer.y }); | |
1383 | + // var _rectLayerOnSaveSplitInt; | |
1384 | + | |
1385 | + | |
1386 | + // _rectLayerOnSaveSplitInt = parseInt(_rectLayerOnSaveSplit[1]); | |
1387 | + | |
1388 | + //alert(_rectLayerOnSaveSplitInt); | |
1389 | + // alert($rootScope.TextPropertyArray.length); | |
1390 | + | |
1391 | + | |
1392 | + for (var i = 0; i <= $rootScope.TextPropertyArray.length - 1; i++) { | |
1393 | + if ($rootScope.TextPropertyArray[i].layerName == TextAreaRectNameConcatenated) { | |
1394 | + | |
1395 | + var textArrVal = $rootScope.TextPropertyArray[i].Text1; | |
1396 | + $("#text_area").val(textArrVal); | |
1397 | + var fontStyleProp = $rootScope.TextPropertyArray[i].FontStyle; | |
1398 | + var fontWeightProp = fontStyleProp.split(" "); | |
1399 | + | |
1400 | + $("#text_area").css("font-size", $rootScope.TextPropertyArray[i].FontSize); | |
1401 | + $("#text_area").css("font-weight", fontWeightProp[0]); | |
1402 | + $("#text_area").css("font-style", fontWeightProp[1]); | |
1403 | + $("#text_area").css("text-align", $rootScope.TextPropertyArray[i].Align); | |
1404 | + $("#text_area").css("color", $rootScope.TextPropertyArray[i].FontColor); | |
1405 | + $("#text_area").css("font-family", $rootScope.TextPropertyArray[i].FontFamily); | |
1406 | + $("#text_area").css("text-decoration", $rootScope.TextPropertyArray[i].TextDecoration); | |
1407 | + $("#font-color .minicolors .minicolors-swatch .minicolors-swatch-color").css({ "background-color": $rootScope.TextPropertyArray[i].FontColor }); | |
1408 | + | |
1409 | + | |
1410 | + | |
1411 | + // $(".ActiveDefaultColorAnnotation").css({ "background-color": $rootScope.TextPropertyArray[_rectLayerOnSaveSplitInt].FontColor + "!important" }); | |
1412 | + // $("#font-color .minicolors .minicolors-swatch .minicolors-swatch-color").addClass("ActiveDefaultColorAnnotation"); | |
1413 | + | |
1414 | + | |
1415 | + //adding text text decoration active class in text edit pop-up | |
1416 | + | |
1417 | + | |
1418 | + | |
1419 | + | |
1420 | + if ($rootScope.TextPropertyArray[i].TextDecoration == "underline") { | |
1421 | + | |
1422 | + $("#text-underline").addClass("ActiveFormattingButtonClass"); | |
1423 | + | |
1424 | + } | |
1425 | + | |
1426 | + else { | |
1427 | + | |
1428 | + $("#text-underline").removeClass("ActiveFormattingButtonClass"); | |
1429 | + | |
1430 | + } | |
1431 | + | |
1432 | + | |
1433 | + | |
1434 | + //adding text font weight active class in text edit pop-up | |
1435 | + | |
1436 | + if (fontWeightProp[0] == 700) { | |
1437 | + | |
1438 | + | |
1439 | + | |
1440 | + $("#text-bold").addClass("ActiveFormattingButtonClass"); | |
1441 | + | |
1442 | + } | |
1443 | + | |
1444 | + else { | |
1445 | + | |
1446 | + $("#text-bold").removeClass("ActiveFormattingButtonClass"); | |
1447 | + | |
1448 | + } | |
1449 | + | |
1450 | + //adding text font style active class in text edit pop-up | |
1451 | + | |
1452 | + if (fontWeightProp[1] == "italic") { | |
1453 | + | |
1454 | + | |
1455 | + $("#text-italic").addClass("ActiveFormattingButtonClass"); | |
1456 | + } | |
1457 | + else { | |
1458 | + $("#text-italic").removeClass("ActiveFormattingButtonClass"); | |
1459 | + | |
1460 | + | |
1461 | + } | |
1462 | + | |
1463 | + //adding text alignment active class in text edit pop-up | |
1464 | + | |
1465 | + if ($rootScope.TextPropertyArray[i].Align == "left") { | |
1466 | + | |
1467 | + $("#text-right").removeClass("ActiveFormattingButtonClass"); | |
1468 | + | |
1469 | + $("#text-center").removeClass("ActiveFormattingButtonClass") | |
1470 | + | |
1471 | + $("#text-left").addClass("ActiveFormattingButtonClass"); | |
1472 | + | |
1473 | + } | |
1474 | + | |
1475 | + else if ($rootScope.TextPropertyArray[i].Align == "right") { | |
1476 | + | |
1477 | + | |
1478 | + | |
1479 | + $("#text-center").removeClass("ActiveFormattingButtonClass") | |
1480 | + | |
1481 | + $("#text-left").removeClass("ActiveFormattingButtonClass"); | |
1482 | + | |
1483 | + $("#text-right").addClass("ActiveFormattingButtonClass"); | |
1484 | + | |
1485 | + | |
1486 | + | |
1487 | + } | |
1488 | + | |
1489 | + else if ($rootScope.TextPropertyArray[i].Align == "center") { | |
1490 | + | |
1491 | + $("#text-left").removeClass("ActiveFormattingButtonClass"); | |
1492 | + | |
1493 | + $("#text-right").removeClass("ActiveFormattingButtonClass"); | |
1494 | + | |
1495 | + $("#text-center").addClass("ActiveFormattingButtonClass"); | |
1496 | + | |
1497 | + | |
1498 | + | |
1499 | + } | |
1500 | + | |
1501 | + | |
1502 | + | |
1503 | + } | |
1504 | + else { | |
1505 | + // alert("no"); | |
1506 | + | |
1507 | + } | |
1508 | + | |
1509 | + } | |
1510 | + | |
1511 | + | |
1512 | + | |
1513 | + | |
1514 | + | |
1515 | + // _rectLayerOnSaveSplitInt = ''; | |
1516 | + textArrVal = ''; | |
1517 | + $("#annotationTextModal").modal("toggle"); | |
1518 | + | |
1519 | + | |
1520 | + | |
1521 | + | |
1522 | + }, | |
1523 | + mouseout: function (layer) { | |
1524 | + $rootScope.canvasLayerNameCollection = []; | |
1525 | + $('#canvas').setLayer(layer.name, { | |
1526 | + handle: { | |
1527 | + type: 'rectangle', | |
1528 | + fillStyle: 'pink', | |
1529 | + strokeStyle: 'yellow', | |
1530 | + strokeWidth: 0, | |
1531 | + width: 0, height: 0, | |
1532 | + cornerRadius: 0 | |
1533 | + } | |
1534 | + }).drawLayers(); | |
1535 | + }, | |
1536 | + mouseover: function (layer) { | |
1537 | + $('#canvas').setLayer(layer.name, { | |
1538 | + handle: { | |
1539 | + type: 'rectangle', | |
1540 | + fillStyle: '#fff', | |
1541 | + strokeStyle: '#c33', | |
1542 | + strokeWidth: 2, | |
1543 | + width: 5, height: 5, | |
1544 | + cornerRadius: 3 | |
1545 | + } | |
1546 | + }).drawLayers(); | |
1547 | + | |
1548 | + } | |
1549 | + }); | |
1550 | + $("#text_area").val(''); | |
1551 | + $("#text_area").css({ " font-family": "'Verdana, sans-serif'", "font-size": "14px", "font-weight": "normal", "font-style": "normal", "color": "#000", "text-align": "left", "text-decoration": "none" }); | |
1552 | + | |
1553 | + $("#font-color .minicolors .minicolors-swatch .minicolors-swatch-color").css({ "background-color": "#000000" }); | |
1554 | + $("#text-italic").removeClass("ActiveFormattingButtonClass"); | |
1555 | + | |
1556 | + $("#text-bold").removeClass("ActiveFormattingButtonClass"); | |
1557 | + | |
1558 | + $("#text-underline").removeClass("ActiveFormattingButtonClass"); | |
1559 | + | |
1560 | + $("#text-left").removeClass("ActiveFormattingButtonClass"); | |
1561 | + | |
1562 | + $("#text-right").removeClass("ActiveFormattingButtonClass"); | |
1563 | + | |
1564 | + $("#text-center").removeClass("ActiveFormattingButtonClass"); | |
1565 | + | |
1566 | + | |
1567 | + } | |
1568 | + | |
1569 | + // this part will work second time when save button will be clicked | |
1570 | + else { | |
1571 | + | |
1572 | + // getting textarea style properties | |
1573 | + var _modifiedText = $("#text_area").val(); | |
1574 | + var _modifiedFontSize = $("#text_area").css("font-size"); | |
1575 | + var _modifiedFontWeight = $("#text_area").css("font-weight"); | |
1576 | + var _modifiedFontStyle = $("#text_area").css("font-style"); | |
1577 | + var _modifiedTextAlign = $("#text_area").css("text-align"); | |
1578 | + var _modifiedFontColor = $("#text_area").css("color"); | |
1579 | + var _modifiedFontFamily = $("#text_area").css("font-family"); | |
1580 | + var _modifiedFontDecoration = $("#text_area").css("text-decoration"); | |
1581 | + | |
1582 | + // deleting previous textarea | |
1583 | + | |
1584 | + | |
1585 | + $("#canvas").removeLayer($rootScope.layerNameArr).drawLayers(); | |
1586 | + $("#canvas").removeLayer($rootScope.rectTextArr).drawLayers(); | |
1587 | + | |
1588 | + $rootScope.resetTextRectSave = $rootScope.ObjectIndexSave++; | |
1589 | + $rootScope.resetTextSave = $rootScope.ObjectIndexSave++; | |
1590 | + | |
1591 | + // generating new text area | |
1592 | + $('#canvas').drawText({ | |
1593 | + layer: true, | |
1594 | + draggable: true, | |
1595 | + name: 'TextAreaAfterEdit_' + $rootScope.resetTextSave, | |
1596 | + groups: ['TextAreaAfterEdit_' + $rootScope.resetTextSave], | |
1597 | + dragGroups: ['TextAreaAfterEdit_' + $rootScope.resetTextSave], | |
1598 | + fillStyle: _modifiedFontColor, | |
1599 | + fontStyle: _modifiedFontWeight + " " + _modifiedFontStyle, | |
1600 | + fontSize: _modifiedFontSize, | |
1601 | + fontFamily: _modifiedFontFamily, | |
1602 | + align: _modifiedTextAlign, | |
1603 | + strokeWidth: 0, | |
1604 | + text: _modifiedText, | |
1605 | + x: $rootScope.rectDimension[$rootScope.rectDimension.length - 1].x, y: $rootScope.rectDimension[$rootScope.rectDimension.length - 1].y, | |
1606 | + maxWidth: $rootScope.rectDimension[$rootScope.rectDimension.length - 1].width, | |
1607 | + maxHeight: $rootScope.rectDimension[$rootScope.rectDimension.length - 1].height | |
1608 | + | |
1609 | + }) | |
1610 | + // Draw rect as wide as the text | |
1611 | + .drawRect({ | |
1612 | + name: 'TextAreaAfterEditRect_' + $rootScope.resetTextSave, | |
1613 | + layer: true, | |
1614 | + draggable: true, | |
1615 | + groups: ['TextAreaAfterEdit_' + $rootScope.resetTextSave], | |
1616 | + dragGroups: ['TextAreaAfterEdit_' + $rootScope.resetTextSave], | |
1617 | + opacity: $rootScope.shapestyleOpacity, | |
1618 | + strokeStyle: $rootScope.shapestyleborderColor, | |
1619 | + strokeWidth: $rootScope.shapestyleborderWidth, | |
1620 | + x: $rootScope.rectDimension[$rootScope.rectDimension.length - 1].x, y: $rootScope.rectDimension[$rootScope.rectDimension.length - 1].y, | |
1621 | + width: $rootScope.rectDimension[$rootScope.rectDimension.length - 1].width, | |
1622 | + height: $rootScope.rectDimension[$rootScope.rectDimension.length - 1].height, | |
1623 | + click: function (layer) { | |
1624 | + $rootScope.shapeTypeText = "textAreaRect"; | |
1625 | + var layerNameSplit = layer.name; | |
1626 | + var splitedName = layerNameSplit.split("_"); | |
1627 | + var textValName = "TextAreaAfterEdit_"; | |
1628 | + var concatinateResult = textValName.concat(splitedName[1]); | |
1629 | + $rootScope.canvasLayerNameCollection = []; | |
1630 | + $rootScope.canvasLayerNameCollection.push({ textareaRectangle: layer.name, textareaString: concatinateResult }); | |
1631 | + | |
1632 | + $('#canvas').setLayer(layer.name, { | |
1633 | + handle: { | |
1634 | + type: 'rectangle', | |
1635 | + fillStyle: '#fff', | |
1636 | + strokeStyle: '#c33', | |
1637 | + strokeWidth: 2, | |
1638 | + width: 5, height: 5, | |
1639 | + cornerRadius: 3 | |
1640 | + } | |
1641 | + }).drawLayers(); | |
1642 | + | |
1643 | + }, | |
1644 | + dblclick: function (layer) { | |
1645 | + | |
1646 | + $rootScope.isTextAreaClosedButtonActive = false; | |
1647 | + $rootScope.IsTextAlreadySave = true; | |
1648 | + var _rectLayerOnSave = layer.name; | |
1649 | + var _rectLayerOnSaveSplit = _rectLayerOnSave.split("_"); | |
1650 | + var RectNameAfterEdit = "TextAreaAfterEdit_"; | |
1651 | + var RectNameAfterEditResult = RectNameAfterEdit.concat(_rectLayerOnSaveSplit[1]); | |
1652 | + $rootScope.modifySavedTextIndexNumber = _rectLayerOnSaveSplit[1]; | |
1653 | + | |
1654 | + $rootScope.layerNameArr = layer.name; | |
1655 | + $rootScope.rectTextArr = RectNameAfterEditResult; | |
1656 | + | |
1657 | + $rootScope.rectDimension.push({ width: layer.width, height: layer.height, x: layer.x, y: layer.y }); | |
1658 | + $("#text_area").val(_modifiedText); | |
1659 | + $("#text_area").css("font-size", _modifiedFontSize); | |
1660 | + $("#text_area").css("font-weight", _modifiedFontWeight); | |
1661 | + $("#text_area").css("font-style", _modifiedFontStyle); | |
1662 | + $("#text_area").css("text-align", _modifiedTextAlign); | |
1663 | + $("#text_area").css("color", _modifiedFontColor); | |
1664 | + $("#text_area").css("font-family", _modifiedFontFamily); | |
1665 | + $("#text_area").css("text-decoration", _modifiedFontDecoration); | |
1666 | + $("#font-color .minicolors .minicolors-swatch .minicolors-swatch-color").css({ "background-color": _modifiedFontColor }); | |
1667 | + // $(".ActiveDefaultColorAnnotation").css({ "background-color": _modifiedFontColor + "!important" }); | |
1668 | + // $("#font-color .minicolors .minicolors-swatch .minicolors-swatch-color").addClass("ActiveDefaultColorAnnotation"); | |
1669 | + | |
1670 | + //adding text text decoration active class in text edit pop-up | |
1671 | + if (_modifiedFontDecoration == "underline") { | |
1672 | + $("#text-underline").addClass("ActiveFormattingButtonClass"); | |
1673 | + } | |
1674 | + else { | |
1675 | + $("#text-underline").removeClass("ActiveFormattingButtonClass"); | |
1676 | + } | |
1677 | + | |
1678 | + //adding text font weight active class in text edit pop-up | |
1679 | + if (_modifiedFontWeight == 700) { | |
1680 | + | |
1681 | + $("#text-bold").addClass("ActiveFormattingButtonClass"); | |
1682 | + } | |
1683 | + else { | |
1684 | + | |
1685 | + $("#text-bold").removeClass("ActiveFormattingButtonClass"); | |
1686 | + | |
1687 | + } | |
1688 | + | |
1689 | + //adding text font style active class in text edit pop-up | |
1690 | + if (_modifiedFontStyle == "italic") { | |
1691 | + | |
1692 | + $("#text-italic").addClass("ActiveFormattingButtonClass"); | |
1693 | + } | |
1694 | + else { | |
1695 | + $("#text-italic").removeClass("ActiveFormattingButtonClass"); | |
1696 | + | |
1697 | + } | |
1698 | + | |
1699 | + //adding text alignment active class in text edit pop-up | |
1700 | + if (_modifiedTextAlign == "left") { | |
1701 | + $("#text-right").removeClass("ActiveFormattingButtonClass"); | |
1702 | + $("#text-center").removeClass("ActiveFormattingButtonClass") | |
1703 | + $("#text-left").addClass("ActiveFormattingButtonClass"); | |
1704 | + } | |
1705 | + else if (_modifiedTextAlign == "right") { | |
1706 | + | |
1707 | + $("#text-center").removeClass("ActiveFormattingButtonClass") | |
1708 | + $("#text-left").removeClass("ActiveFormattingButtonClass"); | |
1709 | + $("#text-right").addClass("ActiveFormattingButtonClass"); | |
1710 | + | |
1711 | + } | |
1712 | + else if (_modifiedTextAlign == "center") { | |
1713 | + $("#text-left").removeClass("ActiveFormattingButtonClass"); | |
1714 | + $("#text-right").removeClass("ActiveFormattingButtonClass"); | |
1715 | + $("#text-center").addClass("ActiveFormattingButtonClass"); | |
1716 | + | |
1717 | + } | |
1718 | + | |
1719 | + | |
1720 | + $("#annotationTextModal").modal("toggle"); | |
1721 | + }, | |
1722 | + mouseout: function (layer) { | |
1723 | + $rootScope.canvasLayerNameCollection = []; | |
1724 | + $('#canvas').setLayer(layer.name, { | |
1725 | + handle: { | |
1726 | + type: 'rectangle', | |
1727 | + fillStyle: 'pink', | |
1728 | + strokeStyle: 'yellow', | |
1729 | + strokeWidth: 0, | |
1730 | + width: 0, height: 0, | |
1731 | + cornerRadius: 0 | |
1732 | + } | |
1733 | + }).drawLayers(); | |
1734 | + }, | |
1735 | + mouseover: function (layer) { | |
1736 | + $('#canvas').setLayer(layer.name, { | |
1737 | + handle: { | |
1738 | + type: 'rectangle', | |
1739 | + fillStyle: '#fff', | |
1740 | + strokeStyle: '#c33', | |
1741 | + strokeWidth: 2, | |
1742 | + width: 5, height: 5, | |
1743 | + cornerRadius: 3 | |
1744 | + } | |
1745 | + }).drawLayers(); | |
1746 | + | |
1747 | + } | |
1748 | + }); | |
1749 | + | |
1750 | + } | |
1751 | + } | |
1752 | + //---- | |
1753 | + | |
1754 | + $rootScope.BindCanvasDrawingListners = function (event) { | |
1755 | + | |
1756 | + $rootScope.clicked = true; | |
1757 | + // OnPaintCanvasMouseDown(event); | |
1758 | + | |
1759 | + var annotationCanvas = document.getElementById('canvas'); | |
1760 | + if (annotationCanvas != null || annotationCanvas != undefined) { | |
1761 | + annotationCanvas.addEventListener('mousedown', $rootScope.OnPaintCanvasMouseDown, false); | |
1762 | + annotationCanvas.addEventListener('mouseup', $rootScope.OnPaintCanvasMouseUp, false); | |
1763 | + } | |
1764 | + // alert("doclick"); | |
1765 | + }; | |
1766 | + | |
1767 | + | |
1768 | + $(document).keydown(function (event) { | |
1769 | + | |
1770 | + // predefined function for detecting keyboard key | |
1771 | + if (event.which == 46) { | |
1772 | + | |
1773 | + if ($rootScope.shapeTypePin == "Pin") { | |
1774 | + | |
1775 | + | |
1776 | + $("#canvas").removeLayer($rootScope.canvasLayerNameCollection[0].pinName).drawLayers(); | |
1777 | + $("#canvas").removeLayer($rootScope.canvasLayerNameCollection[0].ArcName).drawLayers(); | |
1778 | + $rootScope.shapeTypePin = ""; | |
1779 | + | |
1780 | + } | |
1781 | + else if ($rootScope.shapeTypeText == "textAreaRect") { | |
1782 | + | |
1783 | + | |
1784 | + | |
1785 | + $("#canvas").removeLayer($rootScope.canvasLayerNameCollection[0].textareaRectangle).drawLayers(); | |
1786 | + $("#canvas").removeLayer($rootScope.canvasLayerNameCollection[0].textareaString).drawLayers(); | |
1787 | + $rootScope.shapeTypeText = ""; | |
1788 | + | |
1789 | + } | |
1790 | + else { | |
1791 | + | |
1792 | + // alert($rootScope.canvasLayerNameCollection); | |
1793 | + $("#canvas").removeLayer($rootScope.canvasLayerNameCollection).drawLayers(); | |
1794 | + } | |
1795 | + | |
1796 | + | |
1797 | + } | |
1798 | + | |
1799 | + }); | |
1800 | + | |
1801 | + | |
1802 | + $rootScope.closeModal = function () { | |
1803 | + | |
1804 | + | |
1805 | + if ($rootScope.isTextAreaClosedButtonActive == true) { | |
1806 | + $("#canvas").removeLayer('TextArea_' + $rootScope.TextNumber).drawLayers(); | |
1807 | + $("#canvas").removeLayer("TextRect_" + $rootScope.resetTextRect).drawLayers(); | |
1808 | + | |
1809 | + } | |
1810 | + | |
1811 | + } | |
856 | 1812 | //-- End ---------------------------- |
857 | 1813 | |
858 | 1814 | ... | ... |