From a3bd4b7d40cbcbe48d6d7540df20bc0b46137840 Mon Sep 17 00:00:00 2001 From: Julien Coutinho Date: Mon, 8 Jun 2015 16:57:57 +0200 Subject: [PATCH] Fix issues #158 and #125 Add an event triggered on tooltips' views to take into account the last scale factor stored into the screen's view containing the tooltips. Change css position of the container of a screen and its objects to be relative to its own container. --- .../behaviors/workspace/objects/draggable.js | 4 ++++ dahu/core/app/scripts/views/workspace/screen.js | 15 +++++++++++++-- dahu/core/app/styles/main.scss | 1 + 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/dahu/core/app/scripts/behaviors/workspace/objects/draggable.js b/dahu/core/app/scripts/behaviors/workspace/objects/draggable.js index c5e26de..db08107 100644 --- a/dahu/core/app/scripts/behaviors/workspace/objects/draggable.js +++ b/dahu/core/app/scripts/behaviors/workspace/objects/draggable.js @@ -69,6 +69,10 @@ define([ }); } }); + }, + + onScaleChange: function(scale) { + this.scale = scale; } }); diff --git a/dahu/core/app/scripts/views/workspace/screen.js b/dahu/core/app/scripts/views/workspace/screen.js index fa80843..357631e 100644 --- a/dahu/core/app/scripts/views/workspace/screen.js +++ b/dahu/core/app/scripts/views/workspace/screen.js @@ -35,7 +35,8 @@ define([ MouseView, TooltipView, // templates - screenTemplate){ + screenTemplate +) { /** * Workspace screen view @@ -56,6 +57,13 @@ define([ // so that we can render the collection as children // of this parent node this.collection = this.screencast.model.getScreenById(this.screenId).get('objects'); + + // we save the value to update the new tooltips + this.lastScaleFactor = 1.0; + }, + + onAddChild: function(view) { + view.triggerMethod("scale:change", this.lastScaleFactor); }, // We select the ChildView depending on the object type. @@ -72,6 +80,7 @@ define([ onShow: function() { // setup UI //@remove var ctrl = reqres.request('app:screencast:controller'); + var self = this; this.$('.container').css({ //@remove width: ctrl.getScreencastWidth(), @@ -88,8 +97,10 @@ define([ }, function( transform, element ) { // scale the workspace fit.cssTransform(transform, element); + // we save the value to update the new tooltips + self.lastScaleFactor = transform.scale; // notify listener that workspace was scaled - events.trigger('app:workspace:onScaleChanged', transform.scale); + events.trigger('app:workspace:onScaleChanged', self.lastScaleFactor); }); }, diff --git a/dahu/core/app/styles/main.scss b/dahu/core/app/styles/main.scss index 4ae6e3f..bd5e4ed 100644 --- a/dahu/core/app/styles/main.scss +++ b/dahu/core/app/styles/main.scss @@ -99,6 +99,7 @@ html, body { height: 100%; .container { + position: relative; // reset padding and margin added by bootstrap padding: 0px; margin: 0px;