Conversation
…c of deleteObject, added docs
Comments integration adjustments
…ygon and multipolygon can move during edit mode
…multipolygon-brush
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Tip Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs). Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces significant enhancements to the annotation system, focusing on improving user interaction, data management, and developer extensibility. The changes streamline how annotations are selected, edited, and managed within the history panel, while also refining the underlying tools for creating complex shapes like multipolygons. The update also modernizes the build pipeline and expands the event system to support more dynamic and responsive annotation workflows. Highlights
Changelog
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a new buildUI Grunt task using esbuild and updates the package.json to run it post-installation. A significant portion of the changes involves enhancing annotation and layer management within annotations-canvas.js, including refactoring selection logic, improving event emission for layer and annotation selection, and updating the deleteObject method to handle various annotation types and integrate with the history manager. New annotation-related events are documented in EVENTS.md. The AnnotationHistoryManager in history.js is updated to better synchronize with canvas selections, improve UI rendering for selected items, and introduce a _withSelectionSyncPaused mechanism to prevent selection feedback loops. The FreeFormTool and ViewportSegmentation modules receive updates to their canvas sizing, contour processing, and mask generation logic, including polygon simplification and improved pixel detection. Annotation factories in objectAdvancedFactories.js and objectGenericFactories.js are adjusted for highlight creation, text rendering, and editing behavior, with Text annotations now using IText and having improved edit/recalculate logic. Export functionalities in convertor.js and related files are updated to support exporting only selected annotations/layers. Minor fixes include updating comment handling in annotationsGUI.js to use Date.now() and improve reply rendering, and adjusting styling and event handling for UI elements. A review comment highlights a potential Stored XSS vulnerability in history.js due to unescaped user input in an input tag's value attribute. Another comment points out that the selection:cleared event handler in annotations-canvas.js prevents users from deselecting all annotations by clicking on an empty area, suggesting a more intuitive approach for selection clearing.
| mainRowContent = ` | ||
| <label class="show-hint d-block py-1" style="white-space: nowrap; padding-left:0;"> | ||
| <input type="text" | ||
| class="form-control border-0" | ||
| readonly | ||
| style="background:transparent;color: inherit; display:inline-block; padding-left:0" | ||
| value="${objCategory} ${object.label}" | ||
| value="${displayValue}" | ||
| name="category"> | ||
| </label>`; |
There was a problem hiding this comment.
The displayValue variable, which can contain user-controlled metadata (category), is embedded into the value attribute of an input tag without proper escaping. This allows for attribute injection and Stored XSS if the value contains double quotes and a script tag (e.g., "><script>alert(1)</script>).
| this.canvas.on('selection:cleared', function(e) { | ||
| if (!_this.__programmaticClear && e.deselected && e.deselected.length > 0) _this.canvas.setActiveObject(e.deselected[0]); | ||
| _this.__programmaticClear = false; | ||
| }); |
There was a problem hiding this comment.
The selection:cleared event handler prevents users from deselecting all annotations by clicking on an empty area of the canvas. This overrides standard UI behavior and could be frustrating. It appears to be a workaround for accidental deselection.
A more intuitive approach would be to manage selection clearing within the mouse:down event handler. There, you can check if the click is on an empty area and no modifier keys are pressed, and then explicitly clear the selection. This would provide more predictable behavior for the user.
|
Please address also the chat comments. |
No description provided.