Skip to content

Instantly share code, notes, and snippets.

@theredpea
Created August 13, 2018 17:48
Show Gist options
  • Save theredpea/f040a69f192c08a6a8546268767bdb0a to your computer and use it in GitHub Desktop.
Save theredpea/f040a69f192c08a6a8546268767bdb0a to your computer and use it in GitHub Desktop.
define("objects.snapshot/snapshotters/snapshotter", ["jquery", "./object-snapshotter/object-snapshotter", "./sheet-snapshotter/sheet-snapshotter", "./slide-snapshotter/slide-snapshotter", "./story-snapshotter/story-snapshotter"], function(a, b, c, d, e) {
function f(a, c) {
var d = {
left: 0,
top: 0,
width: 1,
height: 1
};
return b.snapshot(a, c.size || {
width: 600,
height: 400
}, c.source, c.sourceSize || {}, d)
}
function g(a, b) {
return c.snapshot(a, b.size || {
width: 600,
height: 400
}, b.source, b.sheetLayout)
}
function h(a, b) {
return d.snapshot(a, b.size || {
width: 600,
height: 400
}, b.source, b.sourceSize)
}
function i(a, b) {
return e.snapshot(a, b.size || {
width: 600,
height: 400
}, b.source, b.sourceSize)
}
var j = {
OBJECT: "object",
SHEET: "sheet",
SLIDE: "slide",
STORY: "story"
};
return {
snapshot: function(a, b, c) {
switch (b) {
case j.SHEET:
return g(a, c || {});
case j.STORY:
return i(a, c || {});
case j.SLIDE:
return h(a, c || {});
case j.OBJECT:
return f(a, c || {})
}
},
cancel: function() {
for (var b, c = Array.prototype.slice.call(document.querySelectorAll(".qv-snapshotter")); b = c.pop(); )
b = a(b).children("div"),
b.slice().each(function(b, c) {
c = a(c),
c.scope && c.scope() && c.scope().$destroy(),
c.remove()
})
},
type: j
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment