diff --git a/app_sources/Artwork/service.js b/app_sources/Artwork/service.js index 31a542a..3fb30e7 100644 --- a/app_sources/Artwork/service.js +++ b/app_sources/Artwork/service.js @@ -33,8 +33,9 @@ app.factory('artworks', ['$q', 'qbind', 'fs', filename: null, }; - // Extract type from extname + // Extract type from extname & filename obj.type = fs.extname(obj.src || ''); + obj.filename = fs.basename(obj.src); // Natural size method differ base on the type var getSize = $q.when(null); @@ -47,18 +48,29 @@ app.factory('artworks', ['$q', 'qbind', 'fs', } else if (obj.type === 'mp4') { getSize = getVideoNaturalSize(obj.src); } - getSize.then(function(size) { obj.size = size; - }); - obj.computeBox = service.computeBox.bind(null, obj); + if(obj.type =='swf'){ + var swfOptions = { + bgcolor: "transparent", + tagId: obj.filename.toLowerCase(), + optionHeight: obj.size.height, + optionWidth:obj.size.width + }; + swf2js.load( + obj.src, + swfOptions); + }; + obj.computeBox = service.computeBox.bind(null, obj); + }); return obj; }; // Compute item bounding box base one config service.computeBox = function(obj, conf, isOverlay) { + // If we miss both config or size, abort if (!conf && !obj.size) return {}; @@ -71,12 +83,17 @@ app.factory('artworks', ['$q', 'qbind', 'fs', box.width = (conf.w || obj.size.width || 0); box.height = (conf.h || obj.size.height || 0); - // Position (x,y) is defined as the position of the center + // Position (x,y) is defined as the position of the center // of the resized artwork relative to window (top,left) // posX = x - (width / 2) box.left = (conf.x - (box.width / 2)) || 0; box.top = (conf.y - (box.height / 2)) || 0; + //SWF placement... please don't ask + if((obj.type == 'swf') && (conf.x <= 0)){ + box.left = box.top = 0; + } + // If the item is an overlay, the previously parsed config // is its artorwk's and the actual size and position can be // deduced from it. diff --git a/app_sources/Artwork/template.html b/app_sources/Artwork/template.html index b531167..a6a021e 100644 --- a/app_sources/Artwork/template.html +++ b/app_sources/Artwork/template.html @@ -1,12 +1,6 @@