From 1fb0b7799834280a759eb238b8d138b60223b1c2 Mon Sep 17 00:00:00 2001 From: jmoenig Date: Tue, 4 Feb 2014 15:29:14 +0100 Subject: Flat line end option in the settings menu, saved with the project --- gui.js | 11 +++++++++++ history.txt | 1 + objects.js | 12 +++++++++--- store.js | 6 +++++- 4 files changed, 26 insertions(+), 4 deletions(-) diff --git a/gui.js b/gui.js index 96903a0..7640393 100644 --- a/gui.js +++ b/gui.js @@ -2211,6 +2211,16 @@ IDE_Morph.prototype.settingsMenu = function () { 'uncheck for greater speed\nat variable frame rates', 'check for smooth, predictable\nanimations across computers' ); + addPreference( + 'Flat line ends', + function () { + SpriteMorph.prototype.useFlatLineEnds = + !SpriteMorph.prototype.useFlatLineEnds; + }, + SpriteMorph.prototype.useFlatLineEnds, + 'uncheck for round ends of lines', + 'check for flat ends of lines' + ); addPreference( 'Codification support', function () { @@ -2689,6 +2699,7 @@ IDE_Morph.prototype.newProject = function () { StageMorph.prototype.codeMappings = {}; StageMorph.prototype.codeHeaders = {}; StageMorph.prototype.enableCodeMapping = false; + SpriteMorph.prototype.useFlatLineEnds = false; this.setProjectName(''); this.projectNotes = ''; this.createStage(); diff --git a/history.txt b/history.txt index 577e17a..e44e138 100755 --- a/history.txt +++ b/history.txt @@ -2080,3 +2080,4 @@ ______ ------ * GUI: Import costumes and backgrounds from the project menu, thanks, Brian, for the changeset! * GUI: Import sounds from the project menu, thanks, Brian, for the changeset! +* Objects, Store, GUI: Flat line end option in the settings menu, saved with the project diff --git a/objects.js b/objects.js index af482b1..1c9a166 100644 --- a/objects.js +++ b/objects.js @@ -124,7 +124,7 @@ PrototypeHatBlockMorph*/ // Global stuff //////////////////////////////////////////////////////// -modules.objects = '2014-January-09'; +modules.objects = '2014-February-04'; var SpriteMorph; var StageMorph; @@ -186,6 +186,7 @@ SpriteMorph.prototype.sliderColor SpriteMorph.prototype.isCachingPrimitives = true; SpriteMorph.prototype.enableNesting = true; +SpriteMorph.prototype.useFlatLineEnds = false; SpriteMorph.prototype.highlightColor = new Color(250, 200, 130); SpriteMorph.prototype.highlightBorder = 8; @@ -2717,8 +2718,13 @@ SpriteMorph.prototype.drawLine = function (start, dest) { if (this.isDown) { context.lineWidth = this.size; context.strokeStyle = this.color.toString(); - context.lineCap = 'round'; - context.lineJoin = 'round'; + if (this.useFlatLineEnds) { + context.lineCap = 'butt'; + context.lineJoin = 'miter'; + } else { + context.lineCap = 'round'; + context.lineJoin = 'round'; + } context.beginPath(); context.moveTo(from.x, from.y); context.lineTo(to.x, to.y); diff --git a/store.js b/store.js index 343dca6..ae9a5d1 100644 --- a/store.js +++ b/store.js @@ -61,7 +61,7 @@ SyntaxElementMorph*/ // Global stuff //////////////////////////////////////////////////////// -modules.store = '2014-January-09'; +modules.store = '2014-February-04'; // XML_Serializer /////////////////////////////////////////////////////// @@ -378,6 +378,8 @@ SnapSerializer.prototype.loadProjectModel = function (xmlNode) { } project.stage.setTempo(model.stage.attributes.tempo); project.stage.setExtent(StageMorph.prototype.dimensions); + SpriteMorph.prototype.useFlatLineEnds = + model.stage.attributes.lines === 'flat'; project.stage.isThreadSafe = model.stage.attributes.threadsafe === 'true'; StageMorph.prototype.enableCodeMapping = @@ -1340,6 +1342,7 @@ StageMorph.prototype.toXML = function (serializer) { '$' + '$' + '' + '$' + @@ -1364,6 +1367,7 @@ StageMorph.prototype.toXML = function (serializer) { this.getCostumeIdx(), this.getTempo(), this.isThreadSafe, + SpriteMorph.prototype.useFlatLineEnds ? 'flat' : 'round', this.enableCodeMapping, StageMorph.prototype.frameRate !== 0, this.trailsCanvas.toDataURL('image/png'), -- cgit v1.3.1