-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Movement Updates #2247
Movement Updates #2247
Conversation
core/inject.js
Outdated
metrics.contentLeft < | ||
(options.RTL ? metrics.viewLeft : edgeLeft) || | ||
(options.RTL ? metrics.viewLeft : metrics.viewLeft) || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why don't remove this condition?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, I need to take another look at this whole function. Coordinates man :/
Thanks for pointing it out to me!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Turns out that I thought the "+ metrics.absoluteLeft" and "+ metrics.absoluteTop" were causing a problem, but the problem was actually that the scrollX and scrollY were not getting set after setMetrics was called, so viewTop and viewLeft were getting calculated incorrectly. This has been fixed.
Everything (except the mainworkspace.isContentBounded_() checks) has been reverted, and the workspaceChanged function is working once again.
Thanks for sending this in for review before diving deeper. The scrollbar code has some important performance constraints, and has been optimized in some non-obvious ways to improve performance. As you play with it you'll want to make sure your changes don't significantly change performance. The most important thing is that The screenshot below is from the performance tab in Chrome developer tools. These tools are really helpful for keeping an eye on performance. For this test I
Here's what that looks like on master, for reference: So far what you've got looks reasonable. Just make sure you keep this stuff in mind. |
… isContentBounded_ to be separate from isMovable_ (b/c of the previous change zoomControls had to be added to the bounded check). Fixed scroll_() calls... again.
…le if the workspace is moveable.
Tag me on this when you're ready to have it reviewed again and I'll take another look. |
…isabled scrollCenter button for this case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's a first pass with comments on the workspace_svg.js portions of this change. I still need to carefully read the changes in inject.js, and I will also pull this code down and play around in the playground to get a feel for it.
Overall it looks good. Your comments are clear and you're keeping track of units, which has been the biggest problem in this code for a long time. Your explanation of scrollX and scrollY is very helpful.
As I mentioned before, performance matters for this code, and I think you're adding extra getMetrics
calls to some code paths. I'm okay with that because I think the resulting code is easier to to understand and debug. We have the time between now and the next release to check on performance implications and make improvements as we find them.
One of those improvements will be adding an opt_metrics
argument to many of these functions. Calling functions would be able to pass in a metrics struct, and each function would only call getMetrics
if none was passed in. However, I want to do that in a separate change so that this one doesn't get any bigger, and so that it will be easy to find in a diff.
* workspace's content should be sized so that it can move (bounded) or not | ||
* (exact sizing). | ||
* @returns {boolean} True if the workspace should be bounded, false otherwise. | ||
* @package |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
General comment: any functions that you add that are @Package should not have underscores at the end of the name. Underscores are a convention to indicate that something is private.
core/workspace_svg.js
Outdated
@@ -1206,17 +1291,44 @@ Blockly.WorkspaceSvg.prototype.isDraggable = function() { | |||
* @private | |||
*/ | |||
Blockly.WorkspaceSvg.prototype.onMouseWheel_ = function(e) { | |||
if (!(this.options.zoomOptions && this.options.zoomOptions.wheel) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're using a very similar check below as well. How about:
var canWheelZoom = this.options.zoomOptions && this.options.zoomOptions.wheel;
var canWheelMove = this.options.moveOptions && this.options.moveOptions.wheel;
if (!canWheelZoom && !canWheelMove) {
return;
}
Then on line 1310 you can check:
if (canWheelZoom && (e.ctrlKey || !canWheelMove)) {
...
}
core/workspace_svg.js
Outdated
this.scrollY = matrix.f - metrics.absoluteTop; | ||
} | ||
|
||
// Transform the x/y out of the canvas' space, so that they're usable. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which units are x and y in after this transform? Workspace coordinates? Or pixels?
if (this.scale == newScale) { | ||
return; // No change in zoom. | ||
} | ||
if (this.scrollbar) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did the this.scrollbar
check disappear? I would expect that you would check it at the beginning of the function rather than waiting until this far in the function, but I didn't expect it to disappear entirely.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This check encapsulated centering the zoom on the mouse pointer, which was only possible before if there were scrollbars. Now we can center on the mouse pointer no matter what, so the check is unnecessary.
// Origin point of 0,0 is fixed, blocks will not scroll to center. | ||
blocksWidth += metrics.contentLeft; | ||
blocksHeight += metrics.contentTop; | ||
// We add the flyout size to the block size because the flyout contains |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a nice touch.
core/workspace_svg.js
Outdated
}; | ||
|
||
/** | ||
* Set the workspace's zoom factor. | ||
* @param {number} newScale Zoom factor. | ||
* @param {number} newScale Zoom factor in pixels/workspaceUnit units. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: this could be mistaken for "pixels OR workspaceUnit units". Change to:
Zoom factor. Units: (pixels / workspaceUnits)
core/workspace_svg.js
Outdated
@@ -1702,10 +1853,11 @@ Blockly.WorkspaceSvg.prototype.setScale = function(newScale) { | |||
if (this.grid_) { | |||
this.grid_.update(this.scale); | |||
} | |||
this.scroll_(this.scrollX, this.scrollY); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why scroll and then adjust scrollbars again?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We call scroll_ instead of scrollbar.resize() so that we can center the zoom correctly without scrollbars, but scroll_ does not resize the scrollbars so we have to call resizeContent as well.
Also added the above as a comment.
core/workspace_svg.js
Outdated
@@ -1714,6 +1866,57 @@ Blockly.WorkspaceSvg.prototype.setScale = function(newScale) { | |||
} | |||
}; | |||
|
|||
/** | |||
* Scroll the workspace by a specified amount (in pixels), keeping in the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Scroll the workspace to a specified offset in pixels, keeping in the workspace bounds.
See comment on workspaceSvg.scrollX for more detail on the meaning of these values."
core/workspace_svg.js
Outdated
this.scrollX = x; | ||
this.scrollY = y; | ||
if (this.scrollbar) { | ||
// The negative x/y values are our new viewLeft and viewTop values. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two comments here:
- there are lots of negations in the comments and in the code, which makes it hard to follow. Consider reframing it to
-(x + metrics.contentLeft)
and describing the meanings of x and contentLeft directly, and then the effect of negating it. - the scrollbars are supposed to be keeping their
ratio_
properties internally. Using those private properties here is a leak. Are there scrollbar functions that will let you do this without using private properties?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
About 2, I changed it over scrollbar.set() but that causes two minor problems:
- set() calls onScroll_ which calls setMetrics etc, adding unnecessary operations.
- set() causes a little bit of jitter after zoom: (watch the lower right corner to observe how the scrollbars aren't placed correctly, then observe the upper left corner to observe the jitter)
The code is currently calling set(), but I can change it back if those problems are deal breakers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The setMetrics part wouldn't be a dealbreaker, only becuase I intend to make another pass to sort out metrics stuff. But the jitter is a problem. Go ahead and put it back to directly accessing the internals, but add a TODO and a github issue to try to sort those two out and not use the private properties in the future.
core/workspace_svg.js
Outdated
|
||
// Hide the WidgetDiv without animation. This is to prevent a disposal | ||
// animation from happening in the wrong location. | ||
Blockly.WidgetDiv.hide(true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move this down to the end of the function, near this.translate
and this.grid_.moveTo
. That way all of the math is done in the first part of the function and all of the actions with side effects are grouped together.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I've added comments on inject.js as well.
core/inject.js
Outdated
var bumpObjects = function(e) { | ||
// We always check isMovable_ again because the original | ||
// "not movable" state of isMovable_ could have been changed. | ||
if (!mainWorkspace.isDragging() && !mainWorkspace.isMovable_() && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See my comment on your bump object event checker, below.
core/inject.js
Outdated
// A reminder for developers to add any events that have to do with | ||
// objects on/in the workspace to the bumpObjects function. Useful when | ||
// testing often happens on a bounded workspace. | ||
var bumpObjectsEventChecker = function(e) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need this function. Adding events isn't a super common thing yet, and this is the sort of information that we should include in the documentation on how to create a new event type instead of having it be a runtime check.
Rather than checking directly against the event types in your change handler, you can make a list in Blockly.Events of event types that should be bumped, and check the event type against that. That way you don't have to enumerate all of the event types all over the place, and that code will be easier to read.
You can put a comment on that list saying that anyone adding a new event type that will cause bumping should add it to the list.
if (!options.readOnly && !mainWorkspace.isMovable_()) { | ||
// Helper functions for the workspaceChanged callback. | ||
var getWorkspaceMetrics = function() { | ||
var workspaceMetrics = Object.create(null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like it's doing a lot of work and checks that normally happen in getMetrics
. Why is all the new math here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The bumpObjects function needs a pretty uncommon set of metrics to work properly:
A) It needs everything in workspace units rather than pixel units.
B) It needs the un-bounded size of the content, even if the content is bounded.
Because the needs were so specific to the bumpObjects function, I wrote everything inside inject, but you're right it is more of a workspace thing. (Also I couldn't come up with a good name, getMetricsUnboundedWorkspaceUnits is a bit longwinded)
I can:
A) Leave as is.
B) Add a new function to the workspace_svg, but I would appreciate a name suggestion.
C) Change the signature of getTopLevelWorkspaceMetrics_() to (bool opt_workspaceUnits, bool opt_forceUnbounded), although this might be a bit confusing because I believe the signature of getMetrics would change for flyouts vs workspaces.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Leave as-is for this change, and add a TODO + github isue to circle back and see if we can move most of it out of inject.
core/inject.js
Outdated
|
||
return workspaceMetrics; | ||
}; | ||
var getWorkspaceObjectMetrics = function(object) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a useful function to define directly on blocks and comments, instead of as a helper function that lives inside the inject code. I'm pretty sure that we're doing exactly this in other places in the code as well, and we can transition those to use the new function as we find them. It'll be minor code duplication, but it'll make this function easier to find and use (and annotate so it shows up in our documentation).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
movedBlocks = true; | ||
} | ||
|
||
switch (e.type) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should a getObjectById() function be added to the workspace so that we can remove this switch statement? Or do you think that's unnecessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that's unnecessary--blocks and comments share a few APIs, but not many, so you'd still usually have to check the type of the object that you got back.
…e page was scrolled).
…es to utils.mouseToSvg.
Ok I have done 2000lbs of testing and it looks solid. Here's everything I tested:
And for every one of those I tested every toolbox position w/ categories and w/ simple toolboxes. I just need replies to this, this, and this, then it should be good to go! |
Looks good! I replied to the outstanding questions; after you handle those I can merge it. For a few of these my answer is "we should fix it, but not in this PR." We have until the next release to make sure everything is 100% correct, and those follow-ups are more about code structure than functionality, and can definitely follow in separate PRs. |
* Avoid crashing when a procedure input has an empty string (google#2182) Fixes google#1958 This will drop the input when it's in the empty string state. This causes the block to remove the input and re-add it when the text is reverted, but prevents the breakage. A followup fix should leave the input alone instead of removing it, but this works for now. * Added message for running local_build.sh from correct folder. * Changes in comment. * Comment out removing tmp directory for testing * Debuggin * Fix generator tests * Bump version number on develop * Updated Comments. * Add error message for when style is not set * Remove use of style variables in block definition * Fixing review comments * Update the style on blocks in the mutator * Fixed scrolling horizontal flyouts with mousewheel. * Changed callback to be looked up dynamically when the button is clicked. * Localisation updates from https://translatewiki.net. * Changed how bubbles position themselves. * Fixed RTL mistake. * Fixes refresh on simple toolbox withno categories * Fix failing test * Localisation updates from https://translatewiki.net. * Fixing review comments * Prevent duplicate parameters in functions (google#2177) Prevents the coder from using duplicate parameters names in functions. In the validator function check for parameter names that have been used. If it finds a block with a name that matches return null so that it will revert the change. Also change the name each time a new parameter is created to try to prevent duplicate name. * Updated createZoomSVG comments. * Changes names for block styles * Enable insertion markers * First pass at creating mocha tests * Add jsunit->chai assert converters, and block tests * More testing with mocha * Skip two broken test suites * Changes Blockly style to be Blockly theme. * Remove dependenceis and use unpkg * Delete commented-out code * Go back to run_all_tests.sh for npm test * Fix eslint errors with in-file comments * Fixes problem with hat style * Adds hat style * Adds support for category styles * Add eslintrc to mocha directory * Fixes error thrown for style defined inline * Small fixes * Added flipRtl Support for FieldImages (google#2203) * Added flipRtl support for FieldImages. Added a flipRtl test block. * Added blockfactory support. * Fixed JSDoc. * Fixing review comments * Final fixes * Added displaying flyout horizontally when layout is horizontal. * Fixed comments not being recorded in delete event. (google#2211) * Remove old eslintrc and use .json for mocha eslintrc * Fixing compiler error for blockly themes * Remove unnecessary scripts * Moved theme scripts out of core * Adding compressed files * Adding accessible uncompressed * Access colours using bracket notation * Localisation updates from https://translatewiki.net. * local_build: Add build for local_blocks_compressed.js (google#2204) * local_build.sh: Add generation of local_blocks_compressed.js * Added comments to local_build.sh * Ignore insertion markers when checking remaining capacity * Added a Finished Loading event. * Updated blockly_uncompressed file. * Update copyright year * Fixed Xml goog.require's. Changed Blockly.Events.Ui functions to Blockly.Events.FinishedLoading. * Changed require's to be in correct lexicographical order. * Changed trashcan and zoom controls to be positioned in the opposite corner of the toolbox. Fixed trashcan hotspot being incorrect. * Added the ability to drag disabled blocks out of the trashcan flyout. * Changed the trashcan lid to always open towards the workspace. * Ignore insertion markers in getAllBlocks; add accessors for inseriton markers * Removed render_ call, which was causing fields to calculate their size incorrectly. * Localisation updates from https://translatewiki.net. * Update procedures.js When I use [Rename variable...] in procedure definition block. The argument name for calling procedure has not changed. * Use a real JS array for the connection DB. Previously “Array.isArray(connectionDB)” was false, even through “connectionDB instanceof Array” was true. * Added a test block for a dynamic dropdown. * Localisation updates from https://translatewiki.net. * Update connection_db_test * New label and title case * Fix event description for theme * Fixed comments and defaults. * Update to latest Closure Template jars, recompile. There was a small chance that the existing Soy jar files contained a denial of service vulnerability. Not that this affects Blockly in any way. https://buganizer.corp.google.com/issues/123937301 * Typo fix in code comment (google#2269) "independent" instead of "independant". * Changes colour names * language-neutral text -> language-neutral id * Check against healing child shadow blocks. Fixes google#2227, healing values. Also applies to shadow next blocks. Added a playground test block group with a shadow statement. * Fixed next blocks not being disabled in flyout. (google#2278) * Fixed horizontal scrolling on window resize. * Fixed flyout scrollbars not being repositioned on window resize. * Update dependencies * Changed flyout setter/change blocks so the selected variable is the most recently created one. * Changed for dynamic variables as well. * Rebuild * Add new message * Fixed multiple trashcans on the same page leaking state. * Localisation updates from https://translatewiki.net. * Fix insertion marker flickering on value inputs (PR google#2295) Merge from rachel-fenichel/bugfix/2255 * Fix insertion marker flickering on value inputs * Rebuild and update version numbers * Fixed multiple trashcans on the same page leaking state. * rebuild after cherry-pick * Fixed bubble positioning to work with simple toolboxes (PR google#2279) Merge from BeksOmega/fixes/BubbleSimpleToolbox * Update version number * Localisation updates from https://translatewiki.net. * Movement Updates (google#2247) This is a squash and merge of a large set of changes by @BeksOmega * Added functionality to scrolling, dragging, and zooming. * Fixed incorrect changes to workspaceChanged function. * Fixed comment. * Fixed typo. * Removed scrollbar.set calls from workspace_svg. * Removed scrollbar.resize() call. * Added move options to playground. * Fixed scroll_ calls that replaced scrollbar.set calls. * Removed this.scrollbar checks. * Changed zoom so that it always zooms towards the coordinates. Changed isContentBounded_ to be separate from isMovable_ (b/c of the previous change zoomControls had to be added to the bounded check). Fixed scroll_() calls... again. * Changed procedures so the Highlight definition option is only available if the workspace is moveable. * Fixed scrollCenter so that it works with flyout toolboxes. * Fixed zoomToFit so that it works with horizontal flyout toolboxes. * Fixed Typo. * Fixed bumping blocks when the workspace is not movable. * Fixed bumping not working with left and top toolbox positions. * Re-Added not allowing scrollCenter if the workspace is not movable. Disabled scrollCenter button for this case. * Cleaned up formatting. * Fixed bumping... again. Reformatted workspaceChanged a bit. * Changed blocks to be completely bumped into the workspace. * Reorganized metrics-getting for workspaceChanged. * Added bumping workspace comments. Moved event checking. * Renamed workspaceChanged to bumpObjects. * Added a bumpObjects developer reminder. * Added warning to zoomToFit. * Cleaned up some text. * Added better inline documentation. * Fixed up inline docs. * Cleaned up comments. * Fixed zoomCenter not actually zooming towards the center. * Fixed zoomControls error on unmovable bottom-toolbox workspaces * Fixed programatically placing blocks in an unmovable workspace. * Removed unnecessary translate call in inject. * Reversed removal of translate. (apparently it was necessary) * Cleaned up code in response to first round of reviews. * Added unit comments to the zoom function. * Removed bumpObjectsEventChecker. Added BUMP_EVENTS list to Blockly.Events. * Changed getWorkspaceObjectMetrics call to getBoundingRectangle(). * Fixed utils.mouseToSvg (was causing problems with zoom on wheel if the page was scrolled). * Fixed zoom when page is scrolled (actually this time). Reverted changes to utils.mouseToSvg. * Fixed centerOnBlock. * Added unit docs to translate. Moved setting the grid position to the translate function. * Added TODO's. * Disable orphaned mutator blocks. (google#2304) * Correcting jsdoc tag spacing (PR google#2303) * Fix hat logic * Fixes block input sticking to the screen when navigated away. * Added scroll delta mode constants. * Add dropdowndiv file * Use dropdown div for colour field * Use dropdown div for dropdowns * Readded the toolbox click subscriber. Added preventing propagation to the toolbox click subscriber. Added clearing touch identifier to the document click subscriber. * Fix error by init of dropdown in case the value is "" (google#2308) I have following dropdown options ``` [ ["no matter", ""] ["Update", "true"] ["Command", "false"] ] ``` In case my value is "" the text is not filled with "no matter" by the initial draw and the empty selector is shown. I expect the text "no matter" This PR fixes that * Changed absolute metrics to avoid simple toolboxes. * Localisation updates from https://translatewiki.net. * Use dropdowndiv for field colour but not field dropdown * Add require and rebuild for travis * css cleanup * Use dropdownDiv for the angle field as well * Add click target property to fields, with accessor * Removed accessing private flyout.width_ variable. * Removed console log. * Added event filtering to workspaceChanged in mutator. (google#2320) * Clarify some dropdown rendering code * Fixed scroll event binding to work with multiple workspaces. * Don't try to bump if the object has already been deleted. * Use constants for dropdown div colours in the colour field * Update toolbox.js Changed style attribute to categorystyle. * Update playground.html * Ran build.py * Removed build changes * Reset blockly_compressed * Missed a few reversions * blockly_compressed was still off. * Localisation updates from https://translatewiki.net. * Fix issue 2061 (google#2326) * Reverts changes to fix bug with selecting dropdown * Localisation updates from https://translatewiki.net. * Add a playgound for debugging SVG paths * Localisation updates from https://translatewiki.net. * Fixed updateToolbox not properly updating flyouts. (google#2332) * Localisation updates from https://translatewiki.net. * Fixed setTheme so it doesn't error when no workspace is created * Refactor setTheme * Add private annotation * Add license; translate the group, not the start point of the path * Delete bad translation This translates back as “% 1 is the name of the renamed variable” which is the translator’s description, not the message. * Fix comment on new message. /// is needed to indicate translator message. * Prevent gestures from being broken by zoom/scroll. * Lint issues found while debugging. * Routine recompile Closure changed, this clears an error. * Remove Python references in Dart math generator Resolves google#2329 Commit in develop branch * Localisation updates from https://translatewiki.net. * Fixed trashcan flyout positioning. * Ignores urls for eslint * Listener functions are no longer wrapped opaquely. * Add comment regarding async nature of listening. * Failing unit tests no longer show useful info. * Fix JSDoc * Delete bad translation This translates back as “% 1 is the name of the renamed variable” which is the translator’s description, not the message. * Line length * Remove Blockly.WidgetDiv.position Nobody appears to call it. * Make drag detection more robust. Previously, one could drag (and hold) a quark outside the bounds of a mutator bubble, then scroll, and the old code wouldn’t query the mutator for gestures. * Consistent speling. * No need to check non-null before nullifying * Use hashes instead of objects. * No keyboard access to quarks during drag. Same issue as zooming with the mouse wheel. * Fix @return JSDocs. * More comprehensive approach to gesture detection. Search all workspaces. The flaw with looking at the workspace of the selected block is that dragging a workspace is a gesture but has no selected block. * Corrections to JSDoc comments * Don’t drop newValue from bubble open events. * Update help URLs to be https. * Localisation updates from https://translatewiki.net. * Update selected menu sizing to fix google#2351 (google#2353) * Adds check for a targetConnection * Fixes test case for unplug * Rename WorkspaceSvg.getFlyout_ (google#2357) * Develop1709 (google#2358) * Remove Python references in Dart math generator Resolves google#2329 Commit in develop branch * first commit for Thomas * Created entry for custom-dialogs Part of issue google#1709 * icon.png for custom dialog demo added * Localisation updates from https://translatewiki.net. * Hides chaff on document mouseup * Fixes bumping too much when in RTL * Fix margins/checkbox in RTL dropdown menus (google#2356) Fixes google#2337 by adding in correct positioning for RTL selected states and fixing an incorrect margin value. * Common prefix for test blocks Fixes google#2103. This will break any saved XML involving the playground’s test blocks. I don’t think any such XML exists on this planet. * Localisation updates from https://translatewiki.net. * Updates function call * typo fix in line 134 of field.js for documentation * Rebuild * Reverts hideChaff fix * Fixed Mutator Flyout Being Positioned Incorrectly RTL (google#2378) * Fixed mutator flyout being positioned incorrectly. * Changed flyout_horizonal and flyout_vertical to check this.targetWorkspace_.toolboxPosition instead of targetWorkspaceMetrics.toolboxPosition. * rebuild * Update version number to 1.20190419.0 * Fix style matching in Firefox 67 Chrome returns ‘transform: translate(107px, 0px);’ whereas Firefox now returns ‘transform: translate(107px);’ if the y value is 0. This is consistent with existing behaviour in the translate SVG attribute. The comment in our code specifically states: // Accounts for same exceptions as XY_REGEX_ Yet that was not true at all. This PR makes the y argument optional (as falsely described in the comment). It also merges the 2D and 3D regeps together to simplify the code. Resolves issue google#2482. Needs to be cherrypicked to Master and everything rebuilt and pushed. * Recompile to pick up XY regex fix. * Set node version explicitly for travis on master
* Storing procedures is now possible * Added confirmation window when overriding * Master update (#20) * Avoid crashing when a procedure input has an empty string (google#2182) Fixes google#1958 This will drop the input when it's in the empty string state. This causes the block to remove the input and re-add it when the text is reverted, but prevents the breakage. A followup fix should leave the input alone instead of removing it, but this works for now. * Added message for running local_build.sh from correct folder. * Changes in comment. * Comment out removing tmp directory for testing * Debuggin * Fix generator tests * Bump version number on develop * Updated Comments. * Add error message for when style is not set * Remove use of style variables in block definition * Fixing review comments * Update the style on blocks in the mutator * Fixed scrolling horizontal flyouts with mousewheel. * Changed callback to be looked up dynamically when the button is clicked. * Localisation updates from https://translatewiki.net. * Changed how bubbles position themselves. * Fixed RTL mistake. * Fixes refresh on simple toolbox withno categories * Fix failing test * Localisation updates from https://translatewiki.net. * Fixing review comments * Prevent duplicate parameters in functions (google#2177) Prevents the coder from using duplicate parameters names in functions. In the validator function check for parameter names that have been used. If it finds a block with a name that matches return null so that it will revert the change. Also change the name each time a new parameter is created to try to prevent duplicate name. * Updated createZoomSVG comments. * Changes names for block styles * Enable insertion markers * First pass at creating mocha tests * Add jsunit->chai assert converters, and block tests * More testing with mocha * Skip two broken test suites * Changes Blockly style to be Blockly theme. * Remove dependenceis and use unpkg * Delete commented-out code * Go back to run_all_tests.sh for npm test * Fix eslint errors with in-file comments * Fixes problem with hat style * Adds hat style * Adds support for category styles * Add eslintrc to mocha directory * Fixes error thrown for style defined inline * Small fixes * Added flipRtl Support for FieldImages (google#2203) * Added flipRtl support for FieldImages. Added a flipRtl test block. * Added blockfactory support. * Fixed JSDoc. * Fixing review comments * Final fixes * Added displaying flyout horizontally when layout is horizontal. * Fixed comments not being recorded in delete event. (google#2211) * Remove old eslintrc and use .json for mocha eslintrc * Fixing compiler error for blockly themes * Remove unnecessary scripts * Moved theme scripts out of core * Adding compressed files * Adding accessible uncompressed * Access colours using bracket notation * Localisation updates from https://translatewiki.net. * local_build: Add build for local_blocks_compressed.js (google#2204) * local_build.sh: Add generation of local_blocks_compressed.js * Added comments to local_build.sh * Ignore insertion markers when checking remaining capacity * Added a Finished Loading event. * Updated blockly_uncompressed file. * Update copyright year * Fixed Xml goog.require's. Changed Blockly.Events.Ui functions to Blockly.Events.FinishedLoading. * Changed require's to be in correct lexicographical order. * Changed trashcan and zoom controls to be positioned in the opposite corner of the toolbox. Fixed trashcan hotspot being incorrect. * Added the ability to drag disabled blocks out of the trashcan flyout. * Changed the trashcan lid to always open towards the workspace. * Ignore insertion markers in getAllBlocks; add accessors for inseriton markers * Removed render_ call, which was causing fields to calculate their size incorrectly. * Localisation updates from https://translatewiki.net. * Update procedures.js When I use [Rename variable...] in procedure definition block. The argument name for calling procedure has not changed. * Use a real JS array for the connection DB. Previously “Array.isArray(connectionDB)” was false, even through “connectionDB instanceof Array” was true. * Added a test block for a dynamic dropdown. * Localisation updates from https://translatewiki.net. * Update connection_db_test * New label and title case * Fix event description for theme * Fixed comments and defaults. * Update to latest Closure Template jars, recompile. There was a small chance that the existing Soy jar files contained a denial of service vulnerability. Not that this affects Blockly in any way. https://buganizer.corp.google.com/issues/123937301 * Typo fix in code comment (google#2269) "independent" instead of "independant". * Changes colour names * language-neutral text -> language-neutral id * Check against healing child shadow blocks. Fixes google#2227, healing values. Also applies to shadow next blocks. Added a playground test block group with a shadow statement. * Fixed next blocks not being disabled in flyout. (google#2278) * Fixed horizontal scrolling on window resize. * Fixed flyout scrollbars not being repositioned on window resize. * Update dependencies * Changed flyout setter/change blocks so the selected variable is the most recently created one. * Changed for dynamic variables as well. * Rebuild * Add new message * Fixed multiple trashcans on the same page leaking state. * Localisation updates from https://translatewiki.net. * Fix insertion marker flickering on value inputs (PR google#2295) Merge from rachel-fenichel/bugfix/2255 * Fix insertion marker flickering on value inputs * Rebuild and update version numbers * Fixed multiple trashcans on the same page leaking state. * rebuild after cherry-pick * Fixed bubble positioning to work with simple toolboxes (PR google#2279) Merge from BeksOmega/fixes/BubbleSimpleToolbox * Update version number * Localisation updates from https://translatewiki.net. * Movement Updates (google#2247) This is a squash and merge of a large set of changes by @BeksOmega * Added functionality to scrolling, dragging, and zooming. * Fixed incorrect changes to workspaceChanged function. * Fixed comment. * Fixed typo. * Removed scrollbar.set calls from workspace_svg. * Removed scrollbar.resize() call. * Added move options to playground. * Fixed scroll_ calls that replaced scrollbar.set calls. * Removed this.scrollbar checks. * Changed zoom so that it always zooms towards the coordinates. Changed isContentBounded_ to be separate from isMovable_ (b/c of the previous change zoomControls had to be added to the bounded check). Fixed scroll_() calls... again. * Changed procedures so the Highlight definition option is only available if the workspace is moveable. * Fixed scrollCenter so that it works with flyout toolboxes. * Fixed zoomToFit so that it works with horizontal flyout toolboxes. * Fixed Typo. * Fixed bumping blocks when the workspace is not movable. * Fixed bumping not working with left and top toolbox positions. * Re-Added not allowing scrollCenter if the workspace is not movable. Disabled scrollCenter button for this case. * Cleaned up formatting. * Fixed bumping... again. Reformatted workspaceChanged a bit. * Changed blocks to be completely bumped into the workspace. * Reorganized metrics-getting for workspaceChanged. * Added bumping workspace comments. Moved event checking. * Renamed workspaceChanged to bumpObjects. * Added a bumpObjects developer reminder. * Added warning to zoomToFit. * Cleaned up some text. * Added better inline documentation. * Fixed up inline docs. * Cleaned up comments. * Fixed zoomCenter not actually zooming towards the center. * Fixed zoomControls error on unmovable bottom-toolbox workspaces * Fixed programatically placing blocks in an unmovable workspace. * Removed unnecessary translate call in inject. * Reversed removal of translate. (apparently it was necessary) * Cleaned up code in response to first round of reviews. * Added unit comments to the zoom function. * Removed bumpObjectsEventChecker. Added BUMP_EVENTS list to Blockly.Events. * Changed getWorkspaceObjectMetrics call to getBoundingRectangle(). * Fixed utils.mouseToSvg (was causing problems with zoom on wheel if the page was scrolled). * Fixed zoom when page is scrolled (actually this time). Reverted changes to utils.mouseToSvg. * Fixed centerOnBlock. * Added unit docs to translate. Moved setting the grid position to the translate function. * Added TODO's. * Disable orphaned mutator blocks. (google#2304) * Correcting jsdoc tag spacing (PR google#2303) * Fix hat logic * Fixes block input sticking to the screen when navigated away. * Added scroll delta mode constants. * Add dropdowndiv file * Use dropdown div for colour field * Use dropdown div for dropdowns * Readded the toolbox click subscriber. Added preventing propagation to the toolbox click subscriber. Added clearing touch identifier to the document click subscriber. * Fix error by init of dropdown in case the value is "" (google#2308) I have following dropdown options ``` [ ["no matter", ""] ["Update", "true"] ["Command", "false"] ] ``` In case my value is "" the text is not filled with "no matter" by the initial draw and the empty selector is shown. I expect the text "no matter" This PR fixes that * Changed absolute metrics to avoid simple toolboxes. * Localisation updates from https://translatewiki.net. * Use dropdowndiv for field colour but not field dropdown * Add require and rebuild for travis * css cleanup * Use dropdownDiv for the angle field as well * Add click target property to fields, with accessor * Removed accessing private flyout.width_ variable. * Removed console log. * Added event filtering to workspaceChanged in mutator. (google#2320) * Clarify some dropdown rendering code * Fixed scroll event binding to work with multiple workspaces. * Don't try to bump if the object has already been deleted. * Use constants for dropdown div colours in the colour field * Update toolbox.js Changed style attribute to categorystyle. * Update playground.html * Ran build.py * Removed build changes * Reset blockly_compressed * Missed a few reversions * blockly_compressed was still off. * Localisation updates from https://translatewiki.net. * Fix issue 2061 (google#2326) * Reverts changes to fix bug with selecting dropdown * Localisation updates from https://translatewiki.net. * Add a playgound for debugging SVG paths * Localisation updates from https://translatewiki.net. * Fixed updateToolbox not properly updating flyouts. (google#2332) * Localisation updates from https://translatewiki.net. * Fixed setTheme so it doesn't error when no workspace is created * Refactor setTheme * Add private annotation * Add license; translate the group, not the start point of the path * Delete bad translation This translates back as “% 1 is the name of the renamed variable” which is the translator’s description, not the message. * Fix comment on new message. /// is needed to indicate translator message. * Prevent gestures from being broken by zoom/scroll. * Lint issues found while debugging. * Routine recompile Closure changed, this clears an error. * Remove Python references in Dart math generator Resolves google#2329 Commit in develop branch * Localisation updates from https://translatewiki.net. * Fixed trashcan flyout positioning. * Ignores urls for eslint * Listener functions are no longer wrapped opaquely. * Add comment regarding async nature of listening. * Failing unit tests no longer show useful info. * Fix JSDoc * Delete bad translation This translates back as “% 1 is the name of the renamed variable” which is the translator’s description, not the message. * Line length * Remove Blockly.WidgetDiv.position Nobody appears to call it. * Make drag detection more robust. Previously, one could drag (and hold) a quark outside the bounds of a mutator bubble, then scroll, and the old code wouldn’t query the mutator for gestures. * Consistent speling. * No need to check non-null before nullifying * Use hashes instead of objects. * No keyboard access to quarks during drag. Same issue as zooming with the mouse wheel. * Fix @return JSDocs. * More comprehensive approach to gesture detection. Search all workspaces. The flaw with looking at the workspace of the selected block is that dragging a workspace is a gesture but has no selected block. * Corrections to JSDoc comments * Don’t drop newValue from bubble open events. * Update help URLs to be https. * Localisation updates from https://translatewiki.net. * Update selected menu sizing to fix google#2351 (google#2353) * Adds check for a targetConnection * Fixes test case for unplug * Rename WorkspaceSvg.getFlyout_ (google#2357) * Develop1709 (google#2358) * Remove Python references in Dart math generator Resolves google#2329 Commit in develop branch * first commit for Thomas * Created entry for custom-dialogs Part of issue google#1709 * icon.png for custom dialog demo added * Localisation updates from https://translatewiki.net. * Hides chaff on document mouseup * Fixes bumping too much when in RTL * Fix margins/checkbox in RTL dropdown menus (google#2356) Fixes google#2337 by adding in correct positioning for RTL selected states and fixing an incorrect margin value. * Common prefix for test blocks Fixes google#2103. This will break any saved XML involving the playground’s test blocks. I don’t think any such XML exists on this planet. * Localisation updates from https://translatewiki.net. * Updates function call * typo fix in line 134 of field.js for documentation * Rebuild * Reverts hideChaff fix * Fixed Mutator Flyout Being Positioned Incorrectly RTL (google#2378) * Fixed mutator flyout being positioned incorrectly. * Changed flyout_horizonal and flyout_vertical to check this.targetWorkspace_.toolboxPosition instead of targetWorkspaceMetrics.toolboxPosition. * rebuild * Update version number to 1.20190419.0 * Fix style matching in Firefox 67 Chrome returns ‘transform: translate(107px, 0px);’ whereas Firefox now returns ‘transform: translate(107px);’ if the y value is 0. This is consistent with existing behaviour in the translate SVG attribute. The comment in our code specifically states: // Accounts for same exceptions as XY_REGEX_ Yet that was not true at all. This PR makes the y argument optional (as falsely described in the comment). It also merges the 2D and 3D regeps together to simplify the code. Resolves issue google#2482. Needs to be cherrypicked to Master and everything rebuilt and pushed. * Recompile to pick up XY regex fix. * Set node version explicitly for travis on master * Fixed issues with merge * Small bugfixes * Added search functionality * Added optional check for dropdown search * made optinal param false by default * Initial logic * Fixed bugs with deleting blocks * Checkmark * Merge * Fixes to search logic * Bug fixes * Bug fixes with insertion markers * Bug fixes to search logic * Search improvement - custom search terms added * Major search optimizations. Hardcoded keywords. * Search refactor * Search keywords added * Added a clearAll for when changing the toolbox * Bugfix when not adding chars to search. Comments and refactoring. * Fable Functions refactored * Added an important TODO * moved custom dialog stuff into blockly
* Storing procedures is now possible * Added confirmation window when overriding * Master update (#20) * Avoid crashing when a procedure input has an empty string (google#2182) Fixes google#1958 This will drop the input when it's in the empty string state. This causes the block to remove the input and re-add it when the text is reverted, but prevents the breakage. A followup fix should leave the input alone instead of removing it, but this works for now. * Added message for running local_build.sh from correct folder. * Changes in comment. * Comment out removing tmp directory for testing * Debuggin * Fix generator tests * Bump version number on develop * Updated Comments. * Add error message for when style is not set * Remove use of style variables in block definition * Fixing review comments * Update the style on blocks in the mutator * Fixed scrolling horizontal flyouts with mousewheel. * Changed callback to be looked up dynamically when the button is clicked. * Localisation updates from https://translatewiki.net. * Changed how bubbles position themselves. * Fixed RTL mistake. * Fixes refresh on simple toolbox withno categories * Fix failing test * Localisation updates from https://translatewiki.net. * Fixing review comments * Prevent duplicate parameters in functions (google#2177) Prevents the coder from using duplicate parameters names in functions. In the validator function check for parameter names that have been used. If it finds a block with a name that matches return null so that it will revert the change. Also change the name each time a new parameter is created to try to prevent duplicate name. * Updated createZoomSVG comments. * Changes names for block styles * Enable insertion markers * First pass at creating mocha tests * Add jsunit->chai assert converters, and block tests * More testing with mocha * Skip two broken test suites * Changes Blockly style to be Blockly theme. * Remove dependenceis and use unpkg * Delete commented-out code * Go back to run_all_tests.sh for npm test * Fix eslint errors with in-file comments * Fixes problem with hat style * Adds hat style * Adds support for category styles * Add eslintrc to mocha directory * Fixes error thrown for style defined inline * Small fixes * Added flipRtl Support for FieldImages (google#2203) * Added flipRtl support for FieldImages. Added a flipRtl test block. * Added blockfactory support. * Fixed JSDoc. * Fixing review comments * Final fixes * Added displaying flyout horizontally when layout is horizontal. * Fixed comments not being recorded in delete event. (google#2211) * Remove old eslintrc and use .json for mocha eslintrc * Fixing compiler error for blockly themes * Remove unnecessary scripts * Moved theme scripts out of core * Adding compressed files * Adding accessible uncompressed * Access colours using bracket notation * Localisation updates from https://translatewiki.net. * local_build: Add build for local_blocks_compressed.js (google#2204) * local_build.sh: Add generation of local_blocks_compressed.js * Added comments to local_build.sh * Ignore insertion markers when checking remaining capacity * Added a Finished Loading event. * Updated blockly_uncompressed file. * Update copyright year * Fixed Xml goog.require's. Changed Blockly.Events.Ui functions to Blockly.Events.FinishedLoading. * Changed require's to be in correct lexicographical order. * Changed trashcan and zoom controls to be positioned in the opposite corner of the toolbox. Fixed trashcan hotspot being incorrect. * Added the ability to drag disabled blocks out of the trashcan flyout. * Changed the trashcan lid to always open towards the workspace. * Ignore insertion markers in getAllBlocks; add accessors for inseriton markers * Removed render_ call, which was causing fields to calculate their size incorrectly. * Localisation updates from https://translatewiki.net. * Update procedures.js When I use [Rename variable...] in procedure definition block. The argument name for calling procedure has not changed. * Use a real JS array for the connection DB. Previously “Array.isArray(connectionDB)” was false, even through “connectionDB instanceof Array” was true. * Added a test block for a dynamic dropdown. * Localisation updates from https://translatewiki.net. * Update connection_db_test * New label and title case * Fix event description for theme * Fixed comments and defaults. * Update to latest Closure Template jars, recompile. There was a small chance that the existing Soy jar files contained a denial of service vulnerability. Not that this affects Blockly in any way. https://buganizer.corp.google.com/issues/123937301 * Typo fix in code comment (google#2269) "independent" instead of "independant". * Changes colour names * language-neutral text -> language-neutral id * Check against healing child shadow blocks. Fixes google#2227, healing values. Also applies to shadow next blocks. Added a playground test block group with a shadow statement. * Fixed next blocks not being disabled in flyout. (google#2278) * Fixed horizontal scrolling on window resize. * Fixed flyout scrollbars not being repositioned on window resize. * Update dependencies * Changed flyout setter/change blocks so the selected variable is the most recently created one. * Changed for dynamic variables as well. * Rebuild * Add new message * Fixed multiple trashcans on the same page leaking state. * Localisation updates from https://translatewiki.net. * Fix insertion marker flickering on value inputs (PR google#2295) Merge from rachel-fenichel/bugfix/2255 * Fix insertion marker flickering on value inputs * Rebuild and update version numbers * Fixed multiple trashcans on the same page leaking state. * rebuild after cherry-pick * Fixed bubble positioning to work with simple toolboxes (PR google#2279) Merge from BeksOmega/fixes/BubbleSimpleToolbox * Update version number * Localisation updates from https://translatewiki.net. * Movement Updates (google#2247) This is a squash and merge of a large set of changes by @BeksOmega * Added functionality to scrolling, dragging, and zooming. * Fixed incorrect changes to workspaceChanged function. * Fixed comment. * Fixed typo. * Removed scrollbar.set calls from workspace_svg. * Removed scrollbar.resize() call. * Added move options to playground. * Fixed scroll_ calls that replaced scrollbar.set calls. * Removed this.scrollbar checks. * Changed zoom so that it always zooms towards the coordinates. Changed isContentBounded_ to be separate from isMovable_ (b/c of the previous change zoomControls had to be added to the bounded check). Fixed scroll_() calls... again. * Changed procedures so the Highlight definition option is only available if the workspace is moveable. * Fixed scrollCenter so that it works with flyout toolboxes. * Fixed zoomToFit so that it works with horizontal flyout toolboxes. * Fixed Typo. * Fixed bumping blocks when the workspace is not movable. * Fixed bumping not working with left and top toolbox positions. * Re-Added not allowing scrollCenter if the workspace is not movable. Disabled scrollCenter button for this case. * Cleaned up formatting. * Fixed bumping... again. Reformatted workspaceChanged a bit. * Changed blocks to be completely bumped into the workspace. * Reorganized metrics-getting for workspaceChanged. * Added bumping workspace comments. Moved event checking. * Renamed workspaceChanged to bumpObjects. * Added a bumpObjects developer reminder. * Added warning to zoomToFit. * Cleaned up some text. * Added better inline documentation. * Fixed up inline docs. * Cleaned up comments. * Fixed zoomCenter not actually zooming towards the center. * Fixed zoomControls error on unmovable bottom-toolbox workspaces * Fixed programatically placing blocks in an unmovable workspace. * Removed unnecessary translate call in inject. * Reversed removal of translate. (apparently it was necessary) * Cleaned up code in response to first round of reviews. * Added unit comments to the zoom function. * Removed bumpObjectsEventChecker. Added BUMP_EVENTS list to Blockly.Events. * Changed getWorkspaceObjectMetrics call to getBoundingRectangle(). * Fixed utils.mouseToSvg (was causing problems with zoom on wheel if the page was scrolled). * Fixed zoom when page is scrolled (actually this time). Reverted changes to utils.mouseToSvg. * Fixed centerOnBlock. * Added unit docs to translate. Moved setting the grid position to the translate function. * Added TODO's. * Disable orphaned mutator blocks. (google#2304) * Correcting jsdoc tag spacing (PR google#2303) * Fix hat logic * Fixes block input sticking to the screen when navigated away. * Added scroll delta mode constants. * Add dropdowndiv file * Use dropdown div for colour field * Use dropdown div for dropdowns * Readded the toolbox click subscriber. Added preventing propagation to the toolbox click subscriber. Added clearing touch identifier to the document click subscriber. * Fix error by init of dropdown in case the value is "" (google#2308) I have following dropdown options ``` [ ["no matter", ""] ["Update", "true"] ["Command", "false"] ] ``` In case my value is "" the text is not filled with "no matter" by the initial draw and the empty selector is shown. I expect the text "no matter" This PR fixes that * Changed absolute metrics to avoid simple toolboxes. * Localisation updates from https://translatewiki.net. * Use dropdowndiv for field colour but not field dropdown * Add require and rebuild for travis * css cleanup * Use dropdownDiv for the angle field as well * Add click target property to fields, with accessor * Removed accessing private flyout.width_ variable. * Removed console log. * Added event filtering to workspaceChanged in mutator. (google#2320) * Clarify some dropdown rendering code * Fixed scroll event binding to work with multiple workspaces. * Don't try to bump if the object has already been deleted. * Use constants for dropdown div colours in the colour field * Update toolbox.js Changed style attribute to categorystyle. * Update playground.html * Ran build.py * Removed build changes * Reset blockly_compressed * Missed a few reversions * blockly_compressed was still off. * Localisation updates from https://translatewiki.net. * Fix issue 2061 (google#2326) * Reverts changes to fix bug with selecting dropdown * Localisation updates from https://translatewiki.net. * Add a playgound for debugging SVG paths * Localisation updates from https://translatewiki.net. * Fixed updateToolbox not properly updating flyouts. (google#2332) * Localisation updates from https://translatewiki.net. * Fixed setTheme so it doesn't error when no workspace is created * Refactor setTheme * Add private annotation * Add license; translate the group, not the start point of the path * Delete bad translation This translates back as “% 1 is the name of the renamed variable” which is the translator’s description, not the message. * Fix comment on new message. /// is needed to indicate translator message. * Prevent gestures from being broken by zoom/scroll. * Lint issues found while debugging. * Routine recompile Closure changed, this clears an error. * Remove Python references in Dart math generator Resolves google#2329 Commit in develop branch * Localisation updates from https://translatewiki.net. * Fixed trashcan flyout positioning. * Ignores urls for eslint * Listener functions are no longer wrapped opaquely. * Add comment regarding async nature of listening. * Failing unit tests no longer show useful info. * Fix JSDoc * Delete bad translation This translates back as “% 1 is the name of the renamed variable” which is the translator’s description, not the message. * Line length * Remove Blockly.WidgetDiv.position Nobody appears to call it. * Make drag detection more robust. Previously, one could drag (and hold) a quark outside the bounds of a mutator bubble, then scroll, and the old code wouldn’t query the mutator for gestures. * Consistent speling. * No need to check non-null before nullifying * Use hashes instead of objects. * No keyboard access to quarks during drag. Same issue as zooming with the mouse wheel. * Fix @return JSDocs. * More comprehensive approach to gesture detection. Search all workspaces. The flaw with looking at the workspace of the selected block is that dragging a workspace is a gesture but has no selected block. * Corrections to JSDoc comments * Don’t drop newValue from bubble open events. * Update help URLs to be https. * Localisation updates from https://translatewiki.net. * Update selected menu sizing to fix google#2351 (google#2353) * Adds check for a targetConnection * Fixes test case for unplug * Rename WorkspaceSvg.getFlyout_ (google#2357) * Develop1709 (google#2358) * Remove Python references in Dart math generator Resolves google#2329 Commit in develop branch * first commit for Thomas * Created entry for custom-dialogs Part of issue google#1709 * icon.png for custom dialog demo added * Localisation updates from https://translatewiki.net. * Hides chaff on document mouseup * Fixes bumping too much when in RTL * Fix margins/checkbox in RTL dropdown menus (google#2356) Fixes google#2337 by adding in correct positioning for RTL selected states and fixing an incorrect margin value. * Common prefix for test blocks Fixes google#2103. This will break any saved XML involving the playground’s test blocks. I don’t think any such XML exists on this planet. * Localisation updates from https://translatewiki.net. * Updates function call * typo fix in line 134 of field.js for documentation * Rebuild * Reverts hideChaff fix * Fixed Mutator Flyout Being Positioned Incorrectly RTL (google#2378) * Fixed mutator flyout being positioned incorrectly. * Changed flyout_horizonal and flyout_vertical to check this.targetWorkspace_.toolboxPosition instead of targetWorkspaceMetrics.toolboxPosition. * rebuild * Update version number to 1.20190419.0 * Fix style matching in Firefox 67 Chrome returns ‘transform: translate(107px, 0px);’ whereas Firefox now returns ‘transform: translate(107px);’ if the y value is 0. This is consistent with existing behaviour in the translate SVG attribute. The comment in our code specifically states: // Accounts for same exceptions as XY_REGEX_ Yet that was not true at all. This PR makes the y argument optional (as falsely described in the comment). It also merges the 2D and 3D regeps together to simplify the code. Resolves issue google#2482. Needs to be cherrypicked to Master and everything rebuilt and pushed. * Recompile to pick up XY regex fix. * Set node version explicitly for travis on master * Fixed issues with merge * Small bugfixes * Added search functionality * Added optional check for dropdown search * made optinal param false by default * Initial logic * Fixed bugs with deleting blocks * Checkmark * Merge * Fixes to search logic * Bug fixes * Bug fixes with insertion markers * Bug fixes to search logic * Search improvement - custom search terms added * Major search optimizations. Hardcoded keywords. * Search refactor * Search keywords added * Added a clearAll for when changing the toolbox * Bugfix when not adding chars to search. Comments and refactoring. * Fable Functions refactored * Added an important TODO * moved custom dialog stuff into blockly * Fixed typo
The basics
The details
Resolves
#2205
Proposed Changes
Adds a new "move" object configuration option with the following properties:
Parsing does not currently allow these options to be independent, but you can make them independent by overriding the drag & wheel options after the workspace has been injected. This behavior is supported.
Changes the zoom function so that the zoom is "anchored" to the mouse position, even without scrollbars.
Reason for Changes
People have requested scroll on wheel. #110
Also I think it may be useful to start separating the movement functionality from scrollbars to work towards #2145
Test Coverage
Independent-ness of Scrollbars/Drag/Scrollwheel
Scrolling and Zooming Interaction
Zooming With and Without Scrollbars
Note: Steps 7&8 of the above make it so the content is no longer bounded. If you were to, for example, override drag to make the content bounded it would zoom towards the center.
Tested on:
Additional Information
All of this works, but there are still some things I want to do (like clean up calls to scrollbars.set) so I consider it a little bit WIP. I just wanted to post a PR before I went too crazy doing things, so I can still change stuff easily.