digirati-annotation-bridge
Advanced tools
Comparing version 0.2.15-alpha.971fcd47 to 0.2.15-alpha.9ccc437e
@@ -5,20 +5,11 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
import AnnotationBody from './annotationBody'; | ||
import { AnnotationSelector } from 'digirati-annotation-redux/es/lib/elucidate/index'; | ||
var W3C_SELECTOR = /[#&\?]xywh\=(pixel\:|percent\:)?(\d+),(\d+),(\d+),(\d+)/; | ||
export function parseTarget(source) { | ||
/** | ||
* @deprecated | ||
*/ | ||
export function parseTarget(target) { | ||
var scale = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1; | ||
var match = W3C_SELECTOR.exec(source); | ||
if (match) { | ||
return { | ||
unit: match[1] === 'percent:' ? 'percent' : 'pixel', | ||
scale: scale, | ||
x: parseInt(match[2], 10) * scale, | ||
y: parseInt(match[3], 10) * scale, | ||
width: parseInt(match[4], 10) * scale, | ||
height: parseInt(match[5], 10) * scale | ||
}; | ||
} | ||
return source; | ||
return AnnotationSelector.parse(target.source, scale, target); | ||
} | ||
@@ -63,4 +54,2 @@ | ||
console.info('RT => ', resourceTemplate, bodyFields); | ||
fields.forEach(function (field) { | ||
@@ -67,0 +56,0 @@ var template = resourceTemplateReverseTypeLookup(resourceTemplate, field); |
@@ -25,21 +25,13 @@ 'use strict'; | ||
var _index = require('digirati-annotation-redux/es/lib/elucidate/index'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var W3C_SELECTOR = /[#&\?]xywh\=(pixel\:|percent\:)?(\d+),(\d+),(\d+),(\d+)/; | ||
function parseTarget(source) { | ||
/** | ||
* @deprecated | ||
*/ | ||
function parseTarget(target) { | ||
var scale = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1; | ||
var match = W3C_SELECTOR.exec(source); | ||
if (match) { | ||
return { | ||
unit: match[1] === 'percent:' ? 'percent' : 'pixel', | ||
scale: scale, | ||
x: parseInt(match[2], 10) * scale, | ||
y: parseInt(match[3], 10) * scale, | ||
width: parseInt(match[4], 10) * scale, | ||
height: parseInt(match[5], 10) * scale | ||
}; | ||
} | ||
return source; | ||
return _index.AnnotationSelector.parse(target.source, scale, target); | ||
} | ||
@@ -84,4 +76,2 @@ | ||
console.info('RT => ', resourceTemplate, bodyFields); | ||
fields.forEach(function (field) { | ||
@@ -88,0 +78,0 @@ var template = resourceTemplateReverseTypeLookup(resourceTemplate, field); |
{ | ||
"name": "digirati-annotation-bridge", | ||
"version": "0.2.15-alpha.971fcd47", | ||
"version": "0.2.15-alpha.9ccc437e", | ||
"description": "Describe annotation-bridge here", | ||
@@ -21,3 +21,3 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"digirati-annotation-redux": "^0.2.15-alpha.971fcd47" | ||
"digirati-annotation-redux": "^0.2.15-alpha.9ccc437e" | ||
}, | ||
@@ -24,0 +24,0 @@ "devDependencies": { |
31231
726