{"action":"created","comment":{"url":"https://api.github.com/repos/sul-dlss/iiifManifestLayouts/pulls/comments/46717246","id":46717246,"diff_hunk":"@@ -0,0 +1,177 @@\n+'use strict';\n+\n+require('openseadragon');\n+\n+var ImageResource = function(config, parent, dispatcher) {\n+  this.needed = config.needed || false;\n+  this.visible = config.visible || false;\n+  this.clipRegion = config.clipRegion;\n+  this.opacity = config.opacity || 1;\n+  this.x = config.x || 0;\n+  this.y = config.y || 0;\n+  this.height = config.height || 1;\n+  this.width = config.width || 1;\n+  this.zIndex = config.zIndex || 0;\n+  this.tileSource = config.tileSource;\n+  this.dynamic = config.dynamic || false;\n+  this.imageType = config.imageType || \"main\"; // can be 'main', 'alternate', or 'detail'\n+  this.status = 'initialized'; // can be 'requested', 'received', 'pending','shown', or 'failed'\n+  this.parent = parent;\n+  this.dispatcher = dispatcher;\n+};\n+\n+ImageResource.prototype = {\n+  hide: function(immediately) {\n+    this.previousOpacity = this.opacity;\n+    this.setOpacity(0, true);\n+    this.visible = false;\n+  },\n+\n+  show: function(immediately) {\n+    this.visible = true;\n+    if(this.previousOpacity) {\n+      this.setOpacity(this.previousOpacity, true);\n+    } else {\n+      this.setOpacity(1, true);\n+    }\n+  },\n+\n+  // todo: take parent opacity into account here and in the constructor\n+  setOpacity: function(opacity, immediately) {\n+    this.opacity = opacity;\n+    if(this.tiledImage) {\n+      this.tiledImage.setOpacity(this.opacity, immediately);\n+    }\n+  },\n+\n+  getOpacity: function() {\n+    return this.opacity;\n+  },\n+\n+  openTileSource: function(viewer) {\n+    var self = this;\n+\n+    // We've already loaded this tilesource\n+    if(this.status === 'shown') {\n+      return;\n+    }\n+\n+    // otherwise, continue loading the tileSource.\n+    this.dispatcher.emit('image-resource-tile-source-requested', { 'detail': this.tileSource });","path":"src/imageResource.js","position":60,"original_position":60,"commit_id":"3dce20ca3eeb28fe8e8485afc329399cf72f2745","original_commit_id":"3dce20ca3eeb28fe8e8485afc329399cf72f2745","user":{"login":"iangilman","id":338989,"avatar_url":"https://avatars.githubusercontent.com/u/338989?v=3","gravatar_id":"","url":"https://api.github.com/users/iangilman","html_url":"https://github.com/iangilman","followers_url":"https://api.github.com/users/iangilman/followers","following_url":"https://api.github.com/users/iangilman/following{/other_user}","gists_url":"https://api.github.com/users/iangilman/gists{/gist_id}","starred_url":"https://api.github.com/users/iangilman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iangilman/subscriptions","organizations_url":"https://api.github.com/users/iangilman/orgs","repos_url":"https://api.github.com/users/iangilman/repos","events_url":"https://api.github.com/users/iangilman/events{/privacy}","received_events_url":"https://api.github.com/users/iangilman/received_events","type":"User","site_admin":false},"body":"Might be useful to include `this` in the event. ","created_at":"2015-12-04T18:53:53Z","updated_at":"2015-12-04T18:53:53Z","html_url":"https://github.com/sul-dlss/iiifManifestLayouts/pull/102#discussion_r46717246","pull_request_url":"https://api.github.com/repos/sul-dlss/iiifManifestLayouts/pulls/102","_links":{"self":{"href":"https://api.github.com/repos/sul-dlss/iiifManifestLayouts/pulls/comments/46717246"},"html":{"href":"https://github.com/sul-dlss/iiifManifestLayouts/pull/102#discussion_r46717246"},"pull_request":{"href":"https://api.github.com/repos/sul-dlss/iiifManifestLayouts/pulls/102"}}},"pull_request":{"url":"https://api.github.com/repos/sul-dlss/iiifManifestLayouts/pulls/102","id":52289158,"html_url":"https://github.com/sul-dlss/iiifManifestLayouts/pull/102","diff_url":"https://github.com/sul-dlss/iiifManifestLayouts/pull/102.diff","patch_url":"https://github.com/sul-dlss/iiifManifestLayouts/pull/102.patch","issue_url":"https://api.github.com/repos/sul-dlss/iiifManifestLayouts/issues/102","number":102,"state":"open","locked":false,"title":"[In progress] Canvas object and ImageResource object","user":{"login":"nein09","id":547883,"avatar_url":"https://avatars.githubusercontent.com/u/547883?v=3","gravatar_id":"","url":"https://api.github.com/users/nein09","html_url":"https://github.com/nein09","followers_url":"https://api.github.com/users/nein09/followers","following_url":"https://api.github.com/users/nein09/following{/other_user}","gists_url":"https://api.github.com/users/nein09/gists{/gist_id}","starred_url":"https://api.github.com/users/nein09/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nein09/subscriptions","organizations_url":"https://api.github.com/users/nein09/orgs","repos_url":"https://api.github.com/users/nein09/repos","events_url":"https://api.github.com/users/nein09/events{/privacy}","received_events_url":"https://api.github.com/users/nein09/received_events","type":"User","site_admin":false},"body":"For https://github.com/sul-dlss/iiifManifestLayouts/issues/40","created_at":"2015-12-01T17:31:34Z","updated_at":"2015-12-04T18:53:53Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a72c6267e0d1de930582e23e4e66502233cd1962","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/sul-dlss/iiifManifestLayouts/pulls/102/commits","review_comments_url":"https://api.github.com/repos/sul-dlss/iiifManifestLayouts/pulls/102/comments","review_comment_url":"https://api.github.com/repos/sul-dlss/iiifManifestLayouts/pulls/comments{/number}","comments_url":"https://api.github.com/repos/sul-dlss/iiifManifestLayouts/issues/102/comments","statuses_url":"https://api.github.com/repos/sul-dlss/iiifManifestLayouts/statuses/3dce20ca3eeb28fe8e8485afc329399cf72f2745","head":{"label":"sul-dlss:canvas-object","ref":"canvas-object","sha":"3dce20ca3eeb28fe8e8485afc329399cf72f2745","user":{"login":"sul-dlss","id":230583,"avatar_url":"https://avatars.githubusercontent.com/u/230583?v=3","gravatar_id":"","url":"https://api.github.com/users/sul-dlss","html_url":"https://github.com/sul-dlss","followers_url":"https://api.github.com/users/sul-dlss/followers","following_url":"https://api.github.com/users/sul-dlss/following{/other_user}","gists_url":"https://api.github.com/users/sul-dlss/gists{/gist_id}","starred_url":"https://api.github.com/users/sul-dlss/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sul-dlss/subscriptions","organizations_url":"https://api.github.com/users/sul-dlss/orgs","repos_url":"https://api.github.com/users/sul-dlss/repos","events_url":"https://api.github.com/users/sul-dlss/events{/privacy}","received_events_url":"https://api.github.com/users/sul-dlss/received_events","type":"Organization","site_admin":false},"repo":{"id":39087703,"name":"iiifManifestLayouts","full_name":"sul-dlss/iiifManifestLayouts","owner":{"login":"sul-dlss","id":230583,"avatar_url":"https://avatars.githubusercontent.com/u/230583?v=3","gravatar_id":"","url":"https://api.github.com/users/sul-dlss","html_url":"https://github.com/sul-dlss","followers_url":"https://api.github.com/users/sul-dlss/followers","following_url":"https://api.github.com/users/sul-dlss/following{/other_user}","gists_url":"https://api.github.com/users/sul-dlss/gists{/gist_id}","starred_url":"https://api.github.com/users/sul-dlss/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sul-dlss/subscriptions","organizations_url":"https://api.github.com/users/sul-dlss/orgs","repos_url":"https://api.github.com/users/sul-dlss/repos","events_url":"https://api.github.com/users/sul-dlss/events{/privacy}","received_events_url":"https://api.github.com/users/sul-dlss/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/sul-dlss/iiifManifestLayouts","description":"","fork":false,"url":"https://api.github.com/repos/sul-dlss/iiifManifestLayouts","forks_url":"https://api.github.com/repos/sul-dlss/iiifManifestLayouts/forks","keys_url":"https://api.github.com/repos/sul-dlss/iiifManifestLayouts/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sul-dlss/iiifManifestLayouts/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sul-dlss/iiifManifestLayouts/teams","hooks_url":"https://api.github.com/repos/sul-dlss/iiifManifestLayouts/hooks","issue_events_url":"https://api.github.com/repos/sul-dlss/iiifManifestLayouts/issues/events{/number}","events_url":"https://api.github.com/repos/sul-dlss/iiifManifestLayouts/events","assignees_url":"https://api.github.com/repos/sul-dlss/iiifManifestLayouts/assignees{/user}","branches_url":"https://api.github.com/repos/sul-dlss/iiifManifestLayouts/branches{/branch}","tags_url":"https://api.github.com/repos/sul-dlss/iiifManifestLayouts/tags","blobs_url":"https://api.github.com/repos/sul-dlss/iiifManifestLayouts/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sul-dlss/iiifManifestLayouts/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sul-dlss/iiifManifestLayouts/git/refs{/sha}","trees_url":"https://api.github.com/repos/sul-dlss/iiifManifestLayouts/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sul-dlss/iiifManifestLayouts/statuses/{sha}","languages_url":"https://api.github.com/repos/sul-dlss/iiifManifestLayouts/languages","stargazers_url":"https://api.github.com/repos/sul-dlss/iiifManifestLayouts/stargazers","contributors_url":"https://api.github.com/repos/sul-dlss/iiifManifestLayouts/contributors","subscribers_url":"https://api.github.com/repos/sul-dlss/iiifManifestLayouts/subscribers","subscription_url":"https://api.github.com/repos/sul-dlss/iiifManifestLayouts/subscription","commits_url":"https://api.github.com/repos/sul-dlss/iiifManifestLayouts/commits{/sha}","git_commits_url":"https://api.github.com/repos/sul-dlss/iiifManifestLayouts/git/commits{/sha}","comments_url":"https://api.github.com/repos/sul-dlss/iiifManifestLayouts/comments{/number}","issue_comment_url":"https://api.github.com/repos/sul-dlss/iiifManifestLayouts/issues/comments{/number}","contents_url":"https://api.github.com/repos/sul-dlss/iiifManifestLayouts/contents/{+path}","compare_url":"https://api.github.com/repos/sul-dlss/iiifManifestLayouts/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sul-dlss/iiifManifestLayouts/merges","archive_url":"https://api.github.com/repos/sul-dlss/iiifManifestLayouts/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sul-dlss/iiifManifestLayouts/downloads","issues_url":"https://api.github.com/repos/sul-dlss/iiifManifestLayouts/issues{/number}","pulls_url":"https://api.github.com/repos/sul-dlss/iiifManifestLayouts/pulls{/number}","milestones_url":"https://api.github.com/repos/sul-dlss/iiifManifestLayouts/milestones{/number}","notifications_url":"https://api.github.com/repos/sul-dlss/iiifManifestLayouts/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sul-dlss/iiifManifestLayouts/labels{/name}","releases_url":"https://api.github.com/repos/sul-dlss/iiifManifestLayouts/releases{/id}","created_at":"2015-07-14T16:46:04Z","updated_at":"2015-11-26T09:25:43Z","pushed_at":"2015-12-03T22:15:57Z","git_url":"git://github.com/sul-dlss/iiifManifestLayouts.git","ssh_url":"git@github.com:sul-dlss/iiifManifestLayouts.git","clone_url":"https://github.com/sul-dlss/iiifManifestLayouts.git","svn_url":"https://github.com/sul-dlss/iiifManifestLayouts","homepage":null,"size":4487,"stargazers_count":2,"watchers_count":2,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":24,"forks":1,"open_issues":24,"watchers":2,"default_branch":"master"}},"base":{"label":"sul-dlss:master","ref":"master","sha":"900f34c7a671ed0a3b32735aff1715ebe83442b5","user":{"login":"sul-dlss","id":230583,"avatar_url":"https://avatars.githubusercontent.com/u/230583?v=3","gravatar_id":"","url":"https://api.github.com/users/sul-dlss","html_url":"https://github.com/sul-dlss","followers_url":"https://api.github.com/users/sul-dlss/followers","following_url":"https://api.github.com/users/sul-dlss/following{/other_user}","gists_url":"https://api.github.com/users/sul-dlss/gists{/gist_id}","starred_url":"https://api.github.com/users/sul-dlss/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sul-dlss/subscriptions","organizations_url":"https://api.github.com/users/sul-dlss/orgs","repos_url":"https://api.github.com/users/sul-dlss/repos","events_url":"https://api.github.com/users/sul-dlss/events{/privacy}","received_events_url":"https://api.github.com/users/sul-dlss/received_events","type":"Organization","site_admin":false},"repo":{"id":39087703,"name":"iiifManifestLayouts","full_name":"sul-dlss/iiifManifestLayouts","owner":{"login":"sul-dlss","id":230583,"avatar_url":"https://avatars.githubusercontent.com/u/230583?v=3","gravatar_id":"","url":"https://api.github.com/users/sul-dlss","html_url":"https://github.com/sul-dlss","followers_url":"https://api.github.com/users/sul-dlss/followers","following_url":"https://api.github.com/users/sul-dlss/following{/other_user}","gists_url":"https://api.github.com/users/sul-dlss/gists{/gist_id}","starred_url":"https://api.github.com/users/sul-dlss/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sul-dlss/subscriptions","organizations_url":"https://api.github.com/users/sul-dlss/orgs","repos_url":"https://api.github.com/users/sul-dlss/repos","events_url":"https://api.github.com/users/sul-dlss/events{/privacy}","received_events_url":"https://api.github.com/users/sul-dlss/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/sul-dlss/iiifManifestLayouts","description":"","fork":false,"url":"https://api.github.com/repos/sul-dlss/iiifManifestLayouts","forks_url":"https://api.github.com/repos/sul-dlss/iiifManifestLayouts/forks","keys_url":"https://api.github.com/repos/sul-dlss/iiifManifestLayouts/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sul-dlss/iiifManifestLayouts/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sul-dlss/iiifManifestLayouts/teams","hooks_url":"https://api.github.com/repos/sul-dlss/iiifManifestLayouts/hooks","issue_events_url":"https://api.github.com/repos/sul-dlss/iiifManifestLayouts/issues/events{/number}","events_url":"https://api.github.com/repos/sul-dlss/iiifManifestLayouts/events","assignees_url":"https://api.github.com/repos/sul-dlss/iiifManifestLayouts/assignees{/user}","branches_url":"https://api.github.com/repos/sul-dlss/iiifManifestLayouts/branches{/branch}","tags_url":"https://api.github.com/repos/sul-dlss/iiifManifestLayouts/tags","blobs_url":"https://api.github.com/repos/sul-dlss/iiifManifestLayouts/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sul-dlss/iiifManifestLayouts/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sul-dlss/iiifManifestLayouts/git/refs{/sha}","trees_url":"https://api.github.com/repos/sul-dlss/iiifManifestLayouts/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sul-dlss/iiifManifestLayouts/statuses/{sha}","languages_url":"https://api.github.com/repos/sul-dlss/iiifManifestLayouts/languages","stargazers_url":"https://api.github.com/repos/sul-dlss/iiifManifestLayouts/stargazers","contributors_url":"https://api.github.com/repos/sul-dlss/iiifManifestLayouts/contributors","subscribers_url":"https://api.github.com/repos/sul-dlss/iiifManifestLayouts/subscribers","subscription_url":"https://api.github.com/repos/sul-dlss/iiifManifestLayouts/subscription","commits_url":"https://api.github.com/repos/sul-dlss/iiifManifestLayouts/commits{/sha}","git_commits_url":"https://api.github.com/repos/sul-dlss/iiifManifestLayouts/git/commits{/sha}","comments_url":"https://api.github.com/repos/sul-dlss/iiifManifestLayouts/comments{/number}","issue_comment_url":"https://api.github.com/repos/sul-dlss/iiifManifestLayouts/issues/comments{/number}","contents_url":"https://api.github.com/repos/sul-dlss/iiifManifestLayouts/contents/{+path}","compare_url":"https://api.github.com/repos/sul-dlss/iiifManifestLayouts/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sul-dlss/iiifManifestLayouts/merges","archive_url":"https://api.github.com/repos/sul-dlss/iiifManifestLayouts/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sul-dlss/iiifManifestLayouts/downloads","issues_url":"https://api.github.com/repos/sul-dlss/iiifManifestLayouts/issues{/number}","pulls_url":"https://api.github.com/repos/sul-dlss/iiifManifestLayouts/pulls{/number}","milestones_url":"https://api.github.com/repos/sul-dlss/iiifManifestLayouts/milestones{/number}","notifications_url":"https://api.github.com/repos/sul-dlss/iiifManifestLayouts/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sul-dlss/iiifManifestLayouts/labels{/name}","releases_url":"https://api.github.com/repos/sul-dlss/iiifManifestLayouts/releases{/id}","created_at":"2015-07-14T16:46:04Z","updated_at":"2015-11-26T09:25:43Z","pushed_at":"2015-12-03T22:15:57Z","git_url":"git://github.com/sul-dlss/iiifManifestLayouts.git","ssh_url":"git@github.com:sul-dlss/iiifManifestLayouts.git","clone_url":"https://github.com/sul-dlss/iiifManifestLayouts.git","svn_url":"https://github.com/sul-dlss/iiifManifestLayouts","homepage":null,"size":4487,"stargazers_count":2,"watchers_count":2,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":24,"forks":1,"open_issues":24,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/sul-dlss/iiifManifestLayouts/pulls/102"},"html":{"href":"https://github.com/sul-dlss/iiifManifestLayouts/pull/102"},"issue":{"href":"https://api.github.com/repos/sul-dlss/iiifManifestLayouts/issues/102"},"comments":{"href":"https://api.github.com/repos/sul-dlss/iiifManifestLayouts/issues/102/comments"},"review_comments":{"href":"https://api.github.com/repos/sul-dlss/iiifManifestLayouts/pulls/102/comments"},"review_comment":{"href":"https://api.github.com/repos/sul-dlss/iiifManifestLayouts/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/sul-dlss/iiifManifestLayouts/pulls/102/commits"},"statuses":{"href":"https://api.github.com/repos/sul-dlss/iiifManifestLayouts/statuses/3dce20ca3eeb28fe8e8485afc329399cf72f2745"}}}}