diff --git a/services/web/public/coffee/ide/pdfng/directives/pdfJs.coffee b/services/web/public/coffee/ide/pdfng/directives/pdfJs.coffee index 981157de86..3adebce715 100644 --- a/services/web/public/coffee/ide/pdfng/directives/pdfJs.coffee +++ b/services/web/public/coffee/ide/pdfng/directives/pdfJs.coffee @@ -128,24 +128,31 @@ define [ # , 1000 scope.fitToHeight = () -> -# pdfListView.setToFitHeight() + scale = angular.copy (scope.scale) + scale.scaleMode = 'scale_mode_fit_height' + scope.scale = scale scope.fitToWidth = () -> -# pdfListView.setToFitWidth() + scale = angular.copy (scope.scale) + scale.scaleMode = 'scale_mode_fit_width' + scope.scale = scale scope.zoomIn = () -> -# scale = pdfListView.getScale() -# pdfListView.setScale(scale * 1.2) + scale = angular.copy (scope.scale) + scale.scaleMode = 'scale_mode_value' + scale.scale = scale.scale * 1.2 + scope.scale = scale scope.zoomOut = () -> -# scale = pdfListView.getScale() -# pdfListView.setScale(scale / 1.2) + scale = angular.copy (scope.scale) + scale.scaleMode = 'scale_mode_value' + scale.scale = scale.scale / 1.2 + scope.scale = scale if attrs.resizeOn? for event in attrs.resizeOn.split(",") scope.$on event, (e) -> console.log 'got a resize event', event, e -# pdfListView.onResize() template: """
diff --git a/services/web/public/coffee/ide/pdfng/directives/pdfViewer.coffee b/services/web/public/coffee/ide/pdfng/directives/pdfViewer.coffee index cfcde2549b..8430f62e97 100644 --- a/services/web/public/coffee/ide/pdfng/directives/pdfViewer.coffee +++ b/services/web/public/coffee/ide/pdfng/directives/pdfViewer.coffee @@ -61,7 +61,7 @@ app.controller 'pdfViewerController', ['$scope', '$q', 'PDFRenderer', '$element' @redraw = (position) -> console.log 'in redraw' console.log 'reseting pages array for', $scope.numPages - console.log 'position is', position + console.log 'position is', position.page, position.offset $scope.pages = ({ pageNum: i } for i in [1 .. $scope.numPages]) @@ -152,9 +152,10 @@ app.controller 'pdfViewerController', ['$scope', '$q', 'PDFRenderer', '$element' return newPosition @computeOffset = (page, position) -> + console.log 'computing offset for', page, position element = page.element pageTop = $(element).offset().top - $(element).parent().offset().top - console.log('top of page scroll is', pageTop) + console.log('top of page scroll is', pageTop, 'vs', page.elemTop) console.log('inner height is', $(element).innerHeight()) offset = position.offset # convert offset to pixels @@ -163,7 +164,7 @@ app.controller 'pdfViewerController', ['$scope', '$q', 'PDFRenderer', '$element' pageOffset = viewport.convertToViewportPoint(offset.left, offset.top) console.log 'addition offset =', pageOffset console.log 'total', pageTop + pageOffset[1] - Math.round(pageTop + pageOffset[1] + 10) ## 10 is margin + Math.round(pageTop + pageOffset[1]) ## 10 is margin @setPdfPosition = (page, position) -> console.log 'required pdf Position is', position @@ -187,7 +188,9 @@ app.directive 'pdfViewer', ['$q', '$timeout', ($q, $timeout) -> "dblClickCallback": "=" } template: """ +