Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var job = {
- //The artwork we are proofing after it has been clipped to avoid losing items.
- name : 'Test',
- artwork : "Test A/W",
- legend : {
- //The selected legend
- proof : undefined,
- //Print Material Selected
- material : "Material",
- //Leading Edge Selected
- leading : undefined,
- //Legend object
- obj : undefined,
- //Core Size
- core : undefined,
- //Number Per Roll
- noPerRoll : undefined,
- //Version No
- version : undefined,
- //Barcode no
- barcode : undefined
- },
- dimentions : {
- cutter : {
- //Cutter width in PX/PT
- width : undefined,
- //Cutter height in PX/PT
- height : undefined
- },
- artwork : {
- //Artwork width in PX/PT
- width : undefined,
- //Artwork height in PX/PT
- height : undefined
- },
- legend : {
- width : undefined,
- height : undefined
- }
- },
- guides : {
- //Corner radius
- cutter : undefined,
- shape : undefined,
- corners : undefined,
- labels : {
- //Width Label. E.G: 180mm
- width : undefined,
- //Height Label. E.G: 180mm
- hight : undefined
- },
- arrows : {
- //True/False as to weather to add leading direction arrow
- enabled : true,
- //File path for the arrow file
- file : {
- right : path + "Assets/Arrows/Leading Arrow Right.pdf",
- left : path + "Assets/Arrows/Leading Arrow Left.pdf",
- },
- //Text to be displayed along side the arrows
- text : "LEAD DIRECTION"
- }
- }
- };
- function ProofJob() {
- };
- ProofJob.prototype = {
- getName : function() {
- return job.name;
- },
- setName : function(name) {
- job.name = name;
- },
- getCutterDimensions : function() {
- return job.dimentions.cutter;
- },
- setCutterDimensions : function(width, height) {
- job.dimentions.cutter = {
- width : width,
- height : height
- };
- job.guides.labels = {
- width: measurmentAsString(api.units.pxToMM(width)),
- height: measurmentAsString(api.units.pxToMM(height))
- };
- },
- getCutterWidth : function() {
- return job.dimentions.cutter.width;
- },
- getCutterHeight : function() {
- return job.dimentions.cutter.height;
- },
- getWidthLabel : function() {
- return job.guides.labels.width;
- },
- getHeightLabel : function() {
- return job.guides.labels.height;
- },
- getSizeLabel : function() {
- var leading = getLeading();
- if (leading == "Right Hand Leading" && leading == "Left Hand Leading") {
- return this.getHeightLabel() + " x " + this.getWidthLabel();
- } else {
- return this.getWidthLabel() + " x " + this.getHeightLabel();
- }
- },
- getArtworkDimensions : function() {
- return job.dimentions.artwork;
- },
- setArtworkDimensions : function(width, height) {
- job.dimentions.artwork = {
- width : width,
- height : height
- };
- },
- getArtworkWidth : function() {
- return job.dimentions.artwork.width;
- },
- getArtworkHeight : function() {
- return job.dimentions.artwork.height;
- },
- getLegendDimentions : function() {
- return job.dimentions.legend;
- },
- setLegendDimentions : function(width, height) {
- job.dimentions.legend = {
- width : width,
- height : height
- }
- },
- getLegendWidth : function() {
- return job.dimentions.legend.width;
- },
- getLegendHeight : function() {
- return job.dimentions.legend.height;
- },
- getCornerRadius : function() {
- return job.guides.corners;
- },
- setCornerRadius : function(radius) {
- job.guides.corners = radius;
- },
- getShape : function() {
- return job.guides.shape;
- },
- setShape : function(shape) {
- job.guides.shape = shape;
- },
- getMaterial : function() {
- return job.legend.material;
- },
- setMaterial : function(material) {
- job.legend.material = material;
- },
- getLeading : function() {
- return job.legend.leading;
- },
- setLeading : function(leading) {
- job.legend.leading = leading;
- },
- getVersion : function() {
- return job.legend.version;
- },
- setVersion : function(version) {
- job.legend.version = version;
- },
- getBarcode : function() {
- return job.legend.barcode;
- },
- setBarcode : function(barcode) {
- job.legend.barcode = barcode;
- },
- getCore : function() {
- return job.legend.core;
- },
- setCore : function(core) {
- job.legend.core = core;
- },
- getNoPerRoll : function() {
- return job.legend.noPerRoll;
- },
- setNoPerRoll : function(noPerRoll) {
- job.legend.noPerRoll = noPerRoll;
- },
- getDate : function() {
- return api.util.dateString();
- },
- getProof : function() {
- return job.legend.proof;
- },
- setProof : function(proof) {
- job.legend.proof = proof;
- },
- getProofObject : function() {
- return job.legend.obj;
- },
- setProofObject : function(obj) {
- alert(job.name);
- alert(job.legend.material);
- job.legend.obj = obj;
- var dimentions = api.util.dimentions(api.util.visibleBounds(obj));
- this.setLegendDimentions(dimentions.width, dimentions.height);
- },
- getArtworkObject : function() {
- return job.artwork;
- },
- setArtworkObject : function(artwork) {
- job.artwork = artwork;
- },
- getArrows : function() {
- return job.guides.arrows.enabled;
- },
- setArrows : function(arrows) {
- job.guides.arrows.enabled = arrows;
- },
- getLeftArrowFile : function() {
- return job.guides.arrows.file.left;
- },
- getRightArrowFile : function() {
- return job.guides.arrows.file.right;
- },
- getCustomCutter : function() {
- return job.guides.cutter;
- },
- setCustomCutter : function(cutter) {
- job.guides.cutter = cutter;
- }
- }
- /*
- * Helpful methods
- */
- function measurmentAsString(measurement) {
- var string = "" + measurement.toFixed(2);
- if (string.indexOf(".00") !== -1) string = string.replace(".00", "");
- if (string.indexOf(".") !== -1 && string.charAt(string.length - 1) == "0") string = string.slice(0, string.length - 1);
- return string + "mm";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement