cleanup pdfJs

This commit is contained in:
Brian Gough 2016-07-05 13:11:11 +01:00
parent 41b0309e6e
commit 70a82c10ce

View file

@ -27,15 +27,6 @@ define [
"dblClickCallback": "=" "dblClickCallback": "="
} }
link: (scope, element, attrs) -> link: (scope, element, attrs) ->
# pdfListView = new PDFListView element.find(".pdfjs-viewer")[0],
# textLayerBuilder: TextLayerBuilder
# annotationsLayerBuilder: AnnotationsLayerBuilder
# highlightsLayerBuilder: HighlightsLayerBuilder
# ondblclick: (e) -> onDoubleClick(e)
# # logLevel: PDFListView.Logger.DEBUG
# pdfListView.listView.pageWidthOffset = 20
# pdfListView.listView.pageHeightOffset = 20
scope.loading = false scope.loading = false
scope.pleaseJumpTo = null scope.pleaseJumpTo = null
scope.scale = null scope.scale = null
@ -56,8 +47,6 @@ define [
"top": +position.offset.top "top": +position.offset.top
"left": +position.offset.left "left": +position.offset.left
#scope.position = pdfListView.getPdfPosition(true)
scope.$on "$destroy", () => scope.$on "$destroy", () =>
localStorage "pdf.scale", scope.scale localStorage "pdf.scale", scope.scale
localStorage "pdf.position.#{attrs.key}", scope.position localStorage "pdf.position.#{attrs.key}", scope.position
@ -84,17 +73,8 @@ define [
scope.loading = true scope.loading = true
scope.loaded = false scope.loaded = false
scope.progress = 1 scope.progress = 1
# console.log 'pdfSrc =', url
initializePosition() initializePosition()
flashControls() flashControls()
# pdfListView
# .loadPdf(url, onProgress)
# .then () ->
# scope.$apply () ->
# scope.loading = false
# delete scope.progress
# initializePosition()
# flashControls()
scope.$on "loaded", () -> scope.$on "loaded", () ->
scope.loaded = true scope.loaded = true
@ -104,37 +84,6 @@ define [
delete scope.progress delete scope.progress
, 500 , 500
#scope.$watch "highlights", (areas) ->
# console.log 'got HIGHLIGHTS in pdfJS', areas
# return if !areas?
# highlights = for area in areas or []
# {
# page: area.page
# highlight:
# left: area.h
# top: area.v
# height: area.height
# width: area.width
# }
# if highlights.length > 0
# first = highlights[0]
# position = {
# page: first.page
# offset:
# left: first.highlight.left
# top: first.highlight.top - 80
# }
# console.log 'position is', position, 'in highlights'
# scope.pleaseJumpTo = position
# pdfListView.clearHighlights()
# pdfListView.setHighlights(highlights, true)
# setTimeout () =>
# pdfListView.clearHighlights()
# , 1000
scope.fitToHeight = () -> scope.fitToHeight = () ->
scale = angular.copy (scope.scale) scale = angular.copy (scope.scale)
scale.scaleMode = 'scale_mode_fit_height' scale.scaleMode = 'scale_mode_fit_height'
@ -161,7 +110,6 @@ define [
for event in attrs.resizeOn.split(",") for event in attrs.resizeOn.split(",")
scope.$on event, (e) -> scope.$on event, (e) ->
#console.log 'got a resize event', event, e #console.log 'got a resize event', event, e
#
scope.$on 'progress', (event, progress) -> scope.$on 'progress', (event, progress) ->
scope.$apply () -> scope.$apply () ->